using ProjectTank.Entities; namespace ProjectTank.Drawnings; /// /// Класс, отвечающий за прорисовку и перемещение объекта-сущности /// public class DrawningTank1 : DrawningTank2 { /// /// Конструктор /// /// Скорость /// Вес автомобиля /// Основной цвет /// Дополнительный цвет /// Признак наличия пушки /// признак наличия пулемета /// public DrawningTank1(int speed, double weight, Color bodyColor, Color additionalColor, bool gun, bool machinGun) : base(150, 87) { EntityTank2 = new EntityTank1(speed, weight, bodyColor, additionalColor, gun, machinGun); } /// /// Прорисовка объекта /// /// public override void DrawTransport(Graphics g) { if (EntityTank2 == null || EntityTank2 is not EntityTank1 Tank1 || !_startPosX.HasValue || !_startPosY.HasValue) { return; } Pen pen = new(Color.Black); Brush additionalBrush = new SolidBrush(Tank1.AdditionalColor); if (Tank1.Gun) { g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 30, 45, 5); g.FillRectangle(additionalBrush, _startPosX.Value, _startPosY.Value + 30, 45, 5); } //пулемет if (Tank1.MachinGun) { g.DrawRectangle(pen, _startPosX.Value + 65, _startPosY.Value + 15, 16, 5); g.DrawRectangle(pen, _startPosX.Value + 72, _startPosY.Value + 10, 5, 5); g.DrawRectangle(pen, _startPosX.Value + 71, _startPosY.Value + 3, 7, 7); g.DrawRectangle(pen, _startPosX.Value + 55, _startPosY.Value + 5, 15, 3); g.FillRectangle(additionalBrush, _startPosX.Value + 65, _startPosY.Value + 15, 16, 5); g.FillRectangle(additionalBrush, _startPosX.Value + 72, _startPosY.Value + 10, 5, 5); g.FillRectangle(additionalBrush, _startPosX.Value + 71, _startPosY.Value + 3, 7, 7); g.FillRectangle(additionalBrush, _startPosX.Value + 55, _startPosY.Value + 5, 15, 3); } _startPosY += 20; base.DrawTransport(g); _startPosY -= 20; } }