41 lines
1.7 KiB
C#
41 lines
1.7 KiB
C#
using WarmlyLocomotive.Entities;
|
|
|
|
namespace WarmlyLocomotive.DrawningObjects
|
|
{
|
|
/// <summary>
|
|
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
|
/// </summary>
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
} |