using AntiAircraftGun.Entities; namespace AntiAircraftGun.Drawnings; /// /// Класс отвечающий за прорисовку и перемещение объекта - сущности /// public class DrawningAntiAircraftGun : DrawningAircraftGun { /// /// Конструктор /// /// Скорость /// Вес /// Основной цвет /// Дополнительный цвет /// Признак наличия башни /// Признак наличия радара public DrawningAntiAircraftGun(int speed, double weight, Color bodyColor, Color additionalColor, bool radar, bool tower) : base(129, 105) { EntityAircraftGun = new EntityAntiAircraftGun(speed, weight, bodyColor, radar, tower, additionalColor); } /// /// Прорисовка объекта /// /// public override void DrawTransport(Graphics g) { if (EntityAircraftGun == null || EntityAircraftGun is not EntityAntiAircraftGun aircraftGun || !_startPosX.HasValue || !_startPosY.HasValue) { return; } Pen pen = new(Color.Black); Brush additionalBrush = new SolidBrush(aircraftGun.AdditionalColor); base.DrawTransport(g); if (aircraftGun.Tower) { g.FillRectangle(additionalBrush, _startPosX.Value + 35, _startPosY.Value + 50, 35, 15); g.DrawRectangle(pen, _startPosX.Value + 35, _startPosY.Value + 50, 35, 15); g.DrawLine(pen, _startPosX.Value + 45, _startPosY.Value + 50, _startPosX.Value + 90, _startPosY.Value + 20); g.DrawLine(pen, _startPosX.Value + 60, _startPosY.Value + 50, _startPosX.Value + 95, _startPosY.Value + 27); g.DrawLine(pen, _startPosX.Value + 45, _startPosY.Value + 50, _startPosX.Value + 60, _startPosY.Value + 50); g.DrawLine(pen, _startPosX.Value + 90, _startPosY.Value + 20, _startPosX.Value + 95, _startPosY.Value + 27); g.DrawLine(pen, _startPosX.Value + 90, _startPosY.Value + 20, _startPosX.Value + 100, _startPosY.Value + 20); g.DrawLine(pen, _startPosX.Value + 100, _startPosY.Value + 20, _startPosX.Value + 95, _startPosY.Value + 27); } if (aircraftGun.Radar) { g.DrawLine(pen, _startPosX.Value + 20, _startPosY.Value + 65, _startPosX.Value + 20, _startPosY.Value + 40); g.FillRectangle(additionalBrush, _startPosX.Value + 10, _startPosY.Value + 40, 20, 20); g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 40, 20, 20); } } }