41 lines
1.6 KiB
C#
Raw Normal View History

2023-11-03 21:51:37 +04:00
using WarmlyLocomotive.Entities;
2023-10-31 15:28:54 +04:00
namespace WarmlyLocomotive.DrawningObjects
{
/// <summary>
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
/// </summary>
public class DrawningPro : DrawningWarmlyLocomotive
{
public DrawningPro(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 Pro(speed, weight, bodyColor, additionalColor, trumpet, luggage);
}
}
public override void DrawTransport(Graphics g)
{
if (EntityWarmlyLocomotive is not Pro 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);
}
}
}
}