45 lines
1.6 KiB
C#
45 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using ContainerShip.Entities;
|
|
|
|
namespace ContainerShip.DrawningObjects
|
|
{
|
|
public class DrawingContainerShip : DrawningShip
|
|
{
|
|
public DrawingContainerShip(int speed, double weight, Color bodyColor, Color
|
|
additionalColor, bool load, bool crane, int width, int height) :
|
|
base(speed, weight, bodyColor, width, height, 140, 90)
|
|
{
|
|
if (EntityShip != null)
|
|
{
|
|
EntityShip = new EntityContainerShip(speed, weight, bodyColor,
|
|
additionalColor, load, crane);
|
|
}
|
|
}
|
|
public override void DrawTransport(Graphics g)
|
|
{
|
|
if (EntityShip is not EntityContainerShip containerShip)
|
|
{
|
|
return;
|
|
}
|
|
Pen pen = new(Color.Black);
|
|
Brush additionalBrush = new
|
|
SolidBrush(containerShip.AdditionalColor);
|
|
if (containerShip.Load)
|
|
{
|
|
g.FillRectangle(additionalBrush, _startPosX + 100, _startPosY + 32, 30, 20); //большой прямоугольник
|
|
}
|
|
base.DrawTransport(g);
|
|
if (containerShip.Crane)
|
|
{
|
|
g.DrawLine(pen, _startPosX + 90, _startPosY + 32, _startPosX + 120, _startPosY);
|
|
g.DrawLine(pen, _startPosX + 80, _startPosY + 32, _startPosX + 120, _startPosY);
|
|
g.DrawLine(pen, _startPosX + 120, _startPosY, _startPosX + 120, _startPosY + 30);
|
|
}
|
|
}
|
|
}
|
|
}
|