попытка

This commit is contained in:
MorozovDanil 2024-04-01 12:07:08 +04:00
parent f832c0c333
commit c387d6137b

View File

@ -19,10 +19,10 @@ public class DrawningContainerShip : DrawningShip
/// <param name="container">Признак наличия контейнеров</param> /// <param name="container">Признак наличия контейнеров</param>
public DrawningContainerShip(int speed, double weight, Color bodyColor, Color additionalColor, bool crane, bool container) : base(125, 60) public DrawningContainerShip(int speed, double weight, Color bodyColor, Color additionalColor, bool crane, bool container) : base(125, 60)
{ {
EntityShip = new EntityContainerShip(speed, weight, bodyColor, additionalColor, crane, container); EntityShip = new EntityContainerShip(speed, weight, bodyColor, additionalColor, crane, container);
} }
/// <returns>true - объект создан, false - проверка не пройдена, нельзя создать объект в этих размерах</returns> /// <returns>true - объект создан, false - проверка не пройдена, нельзя создать объект в этих размерах</returns>
public override void DrawTransport(Graphics g) public override void DrawTransport(Graphics g)
{ {
if (EntityShip == null || EntityShip is not EntityContainerShip containerShip || !_startPosX.HasValue || !_startPosY.HasValue) if (EntityShip == null || EntityShip is not EntityContainerShip containerShip || !_startPosX.HasValue || !_startPosY.HasValue)
{ {
@ -35,6 +35,18 @@ public class DrawningContainerShip : DrawningShip
base.DrawTransport(g); base.DrawTransport(g);
_startPosX -= 5; _startPosX -= 5;
_startPosY -= 30; _startPosY -= 30;
// контейнеры
if (containerShip.Container)
{
g.DrawRectangle(pen, _startPosX.Value + 60, _startPosY.Value + 55, 40, 5);
g.FillRectangle(additionalBrush, _startPosX.Value + 60, _startPosY.Value + 55, 40, 5);
g.DrawRectangle(pen, _startPosX.Value + 60, _startPosY.Value + 50, 40, 5);
g.FillRectangle(additionalBrush, _startPosX.Value + 60, _startPosY.Value + 50, 40, 5);
g.DrawRectangle(pen, _startPosX.Value + 60, _startPosY.Value + 45, 40, 5);
g.FillRectangle(additionalBrush, _startPosX.Value + 60, _startPosY.Value + 45, 40, 5);
}
// кран // кран
if (containerShip.Crane) if (containerShip.Crane)
{ {
@ -47,16 +59,6 @@ public class DrawningContainerShip : DrawningShip
} }
// контейнеры
if (containerShip.Container)
{
g.DrawRectangle(pen, _startPosX.Value + 60, _startPosY.Value + 55, 40, 5);
g.FillRectangle(additionalBrush, _startPosX.Value + 60, _startPosY.Value + 55, 40, 5);
g.DrawRectangle(pen, _startPosX.Value + 60, _startPosY.Value + 50, 40, 5);
g.FillRectangle(additionalBrush, _startPosX.Value + 60, _startPosY.Value + 50, 40, 5);
g.DrawRectangle(pen, _startPosX.Value + 60, _startPosY.Value + 45, 40, 5);
g.FillRectangle(additionalBrush, _startPosX.Value + 60, _startPosY.Value + 45, 40, 5);
}
_startPosX += 5; _startPosX += 5;
_startPosY += 30; _startPosY += 30;