using lab1.Entities; namespace lab1.Drawnings; /// /// Класс, отвечающий за прорисовку и перемещение объекта-сущности /// public class DrawningEntityFighter : DrawningTrackedVehicle { /// /// Конструктор /// /// Скорость /// >Вес истребителя /// Основной цвет /// Дополнительный цвет /// Признак наличия ракет /// Признак наличия доп. крыльев public DrawningEntityFighter(int speed, double weight, Color bodyColor, Color additionalColor, bool rockets, bool extraWings) : base (91, 65) { EntityTrackedVehicle = new EntityFighter(speed, weight, bodyColor, additionalColor, rockets, extraWings); } public override void DrawTransport(Graphics g) { if (EntityTrackedVehicle == null || EntityTrackedVehicle is not EntityFighter fighter || !_startPosX.HasValue || !_startPosY.HasValue) { return; } Pen pen = new(Color.Black); Brush additionalBrush = new SolidBrush(fighter.AdditionalColor); Brush BodyBrush = new SolidBrush(fighter.BodyColor); Brush CraneBrush = new SolidBrush(fighter.AdditionalColor); //корпус g.FillRectangle(BodyBrush, _startPosX.Value + 10, _startPosY.Value + 30, 62, 12); g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 30, 62, 12); g.FillRectangle(BodyBrush, _startPosX.Value + 22, _startPosY.Value + 16, 4, 15); g.DrawRectangle(pen, _startPosX.Value + 22, _startPosY.Value + 16, 4, 14); g.FillRectangle(BodyBrush, _startPosX.Value + 37, _startPosY.Value + 1, 5, 30); g.DrawRectangle(pen, _startPosX.Value + 37, _startPosY.Value + 1, 5, 30); //стекло g.FillRectangle(additionalBrush, _startPosX.Value + 52, _startPosY.Value + 14, 21, 16); g.DrawRectangle(pen, _startPosX.Value + 52, _startPosY.Value + 14, 20, 16); //гусеницы g.DrawLine(pen, _startPosX.Value + 8, _startPosY.Value + 42, _startPosX.Value + 10, _startPosY.Value + 42); g.DrawLine(pen, _startPosX.Value + 7, _startPosY.Value + 43, _startPosX.Value + 7, _startPosY.Value + 53); g.DrawLine(pen, _startPosX.Value + 8, _startPosY.Value + 54, _startPosX.Value + 12, _startPosY.Value + 54); g.DrawLine(pen, _startPosX.Value + 13, _startPosY.Value + 55, _startPosX.Value + 69, _startPosY.Value + 55); g.DrawLine(pen, _startPosX.Value + 70, _startPosY.Value + 54, _startPosX.Value + 73, _startPosY.Value + 54); g.DrawLine(pen, _startPosX.Value + 74, _startPosY.Value + 53, _startPosX.Value + 74, _startPosY.Value + 43); g.DrawLine(pen, _startPosX.Value + 71, _startPosY.Value + 42, _startPosX.Value + 73, _startPosY.Value + 42); //колеса g.FillEllipse(BodyBrush, _startPosX.Value + 10, _startPosY.Value + 44, 9, 9); g.DrawEllipse(pen, _startPosX.Value + 10, _startPosY.Value + 44, 9, 9); g.FillEllipse(BodyBrush, _startPosX.Value + 63, _startPosY.Value + 44, 9, 9); g.DrawEllipse(pen, _startPosX.Value + 63, _startPosY.Value + 44, 9, 9); g.FillEllipse(BodyBrush, _startPosX.Value + 25, _startPosY.Value + 48, 6, 6); g.DrawEllipse(pen, _startPosX.Value + 25, _startPosY.Value + 48, 6, 6); g.FillEllipse(BodyBrush, _startPosX.Value + 38, _startPosY.Value + 48, 6, 6); g.DrawEllipse(pen, _startPosX.Value + 38, _startPosY.Value + 48, 6, 6); g.FillEllipse(BodyBrush, _startPosX.Value + 50, _startPosY.Value + 48, 6, 6); g.DrawEllipse(pen, _startPosX.Value + 50, _startPosY.Value + 48, 6, 6); g.FillEllipse(BodyBrush, _startPosX.Value + 33, _startPosY.Value + 44, 4, 4); g.DrawEllipse(pen, _startPosX.Value + 33, _startPosY.Value + 44, 4, 4); g.FillEllipse(BodyBrush, _startPosX.Value + 45, _startPosY.Value + 44, 4, 4); g.DrawEllipse(pen, _startPosX.Value + 45, _startPosY.Value + 44, 4, 4); _startPosX += 10; _startPosY += 25; base.DrawTransport(g); _startPosX -= 10; _startPosY -= 25; if (fighter.Kovsh) { //ковш g.DrawRectangle(pen, _startPosX.Value - 2, _startPosY.Value + 37, 8, 15); g.FillRectangle(CraneBrush, _startPosX.Value - 2, _startPosY.Value + 37, 8, 15); g.DrawRectangle(pen, _startPosX.Value - -6, _startPosY.Value + 37, 4, 1); } //противовес if (fighter.Otval) { g.DrawRectangle(pen, _startPosX.Value + 73, _startPosY.Value + 37, 17, 1); g.DrawRectangle(pen, _startPosX.Value + 90, _startPosY.Value + 37, 1, 17); } } }