PIbd22_NikiforovaMV_Contain.../ContainerShip/DrawingContainerShip.cs

45 lines
1.5 KiB
C#
Raw Permalink Normal View History

2023-11-25 12:27:56 +04:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2023-11-25 12:44:21 +04:00
using ContainerShip.Entities;
2023-11-25 12:27:56 +04:00
2023-11-25 12:44:21 +04:00
namespace ContainerShip.DrawningObjects
2023-11-25 12:27:56 +04:00
{
2023-11-25 12:44:21 +04:00
public class DrawingContainerShip : DrawningShip
2023-11-25 12:27:56 +04:00
{
2023-11-25 12:44:21 +04:00
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)
2023-11-25 12:27:56 +04:00
{
2023-11-25 12:44:21 +04:00
if (EntityShip != null)
2023-11-25 12:27:56 +04:00
{
2023-11-25 12:44:21 +04:00
EntityShip = new EntityContainerShip(speed, weight, bodyColor,
additionalColor, load, crane);
2023-11-25 12:27:56 +04:00
}
}
2023-11-25 12:44:21 +04:00
public override void DrawTransport(Graphics g)
2023-11-25 12:27:56 +04:00
{
2023-11-25 12:44:21 +04:00
if (EntityShip is not EntityContainerShip containerShip)
2023-11-25 12:27:56 +04:00
{
2023-11-25 12:44:21 +04:00
return;
2023-11-25 12:27:56 +04:00
}
Pen pen = new(Color.Black);
2023-11-25 12:44:21 +04:00
Brush additionalBrush = new
SolidBrush(containerShip.AdditionalColor);
if (containerShip.Load)
2023-11-25 12:27:56 +04:00
{
2023-12-16 11:14:14 +04:00
g.FillRectangle(additionalBrush, _startPosX + 100, _startPosY + 32, 30, 20);
2023-11-25 12:27:56 +04:00
}
2023-11-25 12:44:21 +04:00
base.DrawTransport(g);
if (containerShip.Crane)
2023-11-25 12:27:56 +04:00
{
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);
}
}
}
}