using ProjectStormtrooper.Entities; namespace ProjectStormtrooper.Drawnings; /// /// Класс отвечающий за прорисовку и перемещение объекта-сущности /// public class DrawingStormtrooper: DrawingStormtrooperBase { /// /// Конструктор /// /// /// /// /// /// /// public DrawingStormtrooper(int speed,double weight, Color bodyColor,Color additionalColor, bool rockets, bool bombs):base(140,140) { EntityStormtrooperBase = new EntityStormtrooper(speed, weight, bodyColor, additionalColor, rockets, bombs); } /// /// Прорисовка объекта /// /// public override void DrawTransport(Graphics g) { if (EntityStormtrooperBase == null || EntityStormtrooperBase is not EntityStormtrooper stormtrooper || !_startPosX.HasValue || !_startPosY.HasValue) { return; } Pen pen = new(Color.Black); Brush additionalBrush = new SolidBrush(stormtrooper.AdditionalColor); //ракеты штурмовика if (stormtrooper.Rockets) { g.FillRectangle(additionalBrush, _startPosX.Value + 45, _startPosY.Value + 20, 15, 5); g.FillRectangle(additionalBrush, _startPosX.Value + 45, _startPosY.Value + 110, 15, 5); g.DrawRectangle(pen, _startPosX.Value + 45, _startPosY.Value + 20, 15, 5); g.DrawRectangle(pen, _startPosX.Value + 45, _startPosY.Value + 110, 15, 5); } //бомбы штурмовика if (stormtrooper.Bombs) { g.FillRectangle(additionalBrush, _startPosX.Value + 50, _startPosY.Value + 40, 10, 10); g.FillRectangle(additionalBrush, _startPosX.Value + 50, _startPosY.Value + 90, 10, 10); g.DrawRectangle(pen, _startPosX.Value + 50, _startPosY.Value + 40, 10, 10); g.DrawRectangle(pen, _startPosX.Value + 50, _startPosY.Value + 90, 10, 10); } base.DrawTransport(g); } }