using System.Drawing.Drawing2D; using ProjectCruiser.Entities; namespace ProjectCruiser.DrawningSamples; public class DrawningCruiser : DrawningBase { // Инициализация свойств (все параметры класса (сущности)) public DrawningCruiser(int speed, double weight, Color bodyColor, Color additionalColor, bool pads, bool hangar) : base(302, 42) // all additional featchures 'inside' object, so size remains { EntityTransport = new EntityCruiser(speed, weight, bodyColor, additionalColor, pads, hangar); } public override void DrawTransport(Graphics g) { if (EntityTransport == null || EntityTransport is not EntityCruiser ship || !_startPosX.HasValue || !_startPosY.HasValue) // [ !!! ] :O { return; } Pen pen = new(Color.Black, 2); Brush PadBrush = new HatchBrush(HatchStyle.DottedDiamond, Color.LightGray, Color.Black); Brush additionalBrush = new SolidBrush(ship.AdditionalColor); //границы cruiser <...> // & // салон на верхней палубе : base.DrawTransport(g); // вертолетная площадка if (ship.HelicopterPads) { g.DrawEllipse(pen, _startPosX.Value + 170, _startPosY.Value + 11, 20, 20); g.FillEllipse(PadBrush, _startPosX.Value + 170, _startPosY.Value + 11, 20, 20); } // ангар if (ship.Hangar) { int n = EntityTransport.values[2]; if (n == 1) g.FillRectangle(additionalBrush, _startPosX.Value + 250, _startPosY.Value + 20, 14, 7); else { g.FillRectangle(additionalBrush, _startPosX.Value + 80, _startPosY.Value + 10, 10, 20); g.FillRectangle(additionalBrush, _startPosX.Value + 70, _startPosY.Value + 12, 8, 12); } } } }