using WarmlyLocomotive.Entities; namespace WarmlyLocomotive.Drawnings; /// /// Класс, отвечающий за прорисовку и перемещение объекта-сущности /// public class DrawningWarmlyLocomotive : DrawningLocomotive { /// /// Класс-сущность /// public DrawningWarmlyLocomotive(int speed, double weight, Color bodyColor, Color additionalColor, bool tube, bool fuelTank) : base(150, 100) { EntityLocomotive = new EntityWarmlyLocomotive(speed, weight, bodyColor, additionalColor, tube, fuelTank); } public override void DrawTransport(Graphics g) { if (EntityLocomotive == null || EntityLocomotive is not EntityWarmlyLocomotive warmlyLocomotive || !_startPosX.HasValue || !_startPosY.HasValue) { return; } Pen pen = new(Color.Black); Brush additionalBrush = new SolidBrush(warmlyLocomotive.AdditionalColor); //труба if (warmlyLocomotive.Tube) { g.DrawRectangle(pen, _startPosX.Value + 40, _startPosY.Value, 20, 30); g.FillRectangle(additionalBrush, _startPosX.Value + 40, _startPosY.Value, 20, 40); } // отсек для топлива if (warmlyLocomotive.FuelTank) { g.DrawRectangle(pen, _startPosX.Value + 80, _startPosY.Value + 40, 50, 40); g.FillRectangle(additionalBrush, _startPosX.Value + 80, _startPosY.Value + 40, 50, 40); } } }