50 lines
1.9 KiB
C#
50 lines
1.9 KiB
C#
|
using WarmlyLocomotive.DrawningObjects;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using WarmlyLocomotive.Entities;
|
|||
|
using WarmlyLocomotive;
|
|||
|
|
|||
|
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;
|
|||
|
}
|
|||
|
Pen pen = new(Color.Black, 2);
|
|||
|
Brush bodyBrush = new SolidBrush(warmlylocomotive.BodyColor);
|
|||
|
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);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|