PIbd-23_Starostin_I.K._Lain.../lainer/Lainer1/DrawingSuperLainer.cs

53 lines
2.2 KiB
C#

using ProjectLainer.Entities;
namespace ProjectLainer.DrawningObjects
{
public class DrawningSuperLainer : DrawingLainer
{
public DrawningSuperLainer(int speed, double weight, Color bodyColor, Color
additionalColor, bool pools, bool decks, int width, int height) : base(speed, weight, bodyColor, width, height, 110, 60)
{
if (EntityLainer != null)
{
EntityLainer = new EntitySuperLainer(speed, weight, bodyColor,
additionalColor, pools, decks);
}
}
public override void DrawTransport(Graphics g)
{
if (EntityLainer is not EntitySuperLainer superlainer)
{
return;
}
base.DrawTransport(g);
Brush brBlue = new SolidBrush(Color.LightBlue);
Pen pen = new(Color.Black);
Brush additionalBrush = new SolidBrush(superlainer.AdditionalColor);
if (superlainer.Decks)
{
Point point1 = new Point(_startPosX, _startPosY + 10);
Point point2 = new Point(_startPosX + GetWidth, _startPosY + 10);
Point point3 = new Point(_startPosX + 20, _startPosY + 30);
Point point4 = new Point(_startPosX + 80, _startPosY + 30);
Point[] points = { point1, point2, point4, point3 };
g.DrawPolygon(pen, points);
g.FillPolygon(additionalBrush, points);
}
else
{
Point point3 = new Point(_startPosX, _startPosY + 30);
Point point4 = new Point(_startPosX + GetWidth, _startPosY + 30);
Point point1 = new Point(_startPosX + 20, _startPosY + 10);
Point point2 = new Point(_startPosX + 80, _startPosY + 10);
Point[] points = { point1, point2, point4, point3 };
g.DrawPolygon(pen, points);
g.FillPolygon(additionalBrush, points);
}
for (int i = 2; i < 5; i++)
{
g.FillEllipse(brBlue, _startPosX + i * 16, _startPosY + 15, 12, 12);
}
}
}
}