using WarmlyLocomotive.Entities; namespace WarmlyLocomotive.DrawningObjects { /// /// Класс, отвечающий за прорисовку и перемещение объекта-сущности /// public class DrawningWarmlyLocomotiveWithTrumpet : DrawningWarmlyLocomotive { public DrawningWarmlyLocomotiveWithTrumpet(int speed, double weight, Color bodyColor, Color additionalColor, bool trumpet, bool luggage, int width, int height) :base(speed, weight, bodyColor, width, height, 200, 75) { if (EntityWarmlyLocomotive != null) { EntityWarmlyLocomotive = new EntityWarmlyLocomotiveWithTrumpet(speed, weight, bodyColor, additionalColor, trumpet, luggage); } } public override void DrawTransport(Graphics g) { if (EntityWarmlyLocomotive is not EntityWarmlyLocomotiveWithTrumpet warmlylocomotive) { return; } Brush addBrush = new SolidBrush(warmlylocomotive.AdditionalColor); Brush wheelBrush = new SolidBrush(Color.Black); base.DrawTransport(g); //труба if (warmlylocomotive.Trumpet) { g.FillRectangle(addBrush, _startPosX + 165, _startPosY - 25, 25, 25); } //багаж if (warmlylocomotive.Luggage) { g.FillRectangle(addBrush, _startPosX, _startPosY, 50, 50); g.FillEllipse(wheelBrush, _startPosX + 10, _startPosY + 50, 20, 20); g.FillEllipse(wheelBrush, _startPosX + 35, _startPosY + 50, 20, 20); } } } }