базовый объект и его прорисовка
This commit is contained in:
parent
69df949971
commit
781604b4a5
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace WarmlyLocomotive;
|
namespace WarmlyLocomotive.Drawnings;
|
||||||
|
|
||||||
public enum DirectionType
|
public enum DirectionType
|
||||||
{
|
{
|
@ -1,13 +1,15 @@
|
|||||||
namespace WarmlyLocomotive;
|
using WarmlyLocomotive.Entities;
|
||||||
|
|
||||||
|
namespace WarmlyLocomotive.Drawnings;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DrawningWarmlyLocomotive
|
public class DrawningLocomotive
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Класс-сущность
|
/// Класс-сущность
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public EntityWarmlyLocomotive? EntityWarmlyLocomotive { get; private set; }
|
public EntityLocomotive? EntityLocomotive { get; protected set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ширина окна
|
/// Ширина окна
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -17,36 +19,88 @@ public class DrawningWarmlyLocomotive
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private int? _pictureHeight;
|
private int? _pictureHeight;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Левая координата прорисовки автомобиля
|
/// Левая координата прорисовки паровоза
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int? _startPosX;
|
protected int? _startPosX;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Верхняя кооридната прорисовки автомобиля
|
/// Верхняя кооридната прорисовки паровоза
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int? _startPosY;
|
protected int? _startPosY;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ширина прорисовки автомобиля
|
/// Ширина прорисовки паровоза
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly int _drawningLocomotiveWidth = 150;
|
private readonly int _drawningLocomotiveWidth = 150;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Высота прорисовки автомобиля
|
/// Высота прорисовки паровоза
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly int _drawningLocomotiveHeight = 100;
|
private readonly int _drawningLocomotiveHeight = 100;
|
||||||
/// <summary>
|
|
||||||
/// Инициализация свойств
|
|
||||||
/// </summary>
|
|
||||||
|
|
||||||
public void Init(int speed, double weight, Color bodyColor, Color
|
/// <summary>
|
||||||
additionalColor, bool tube, bool fuelTank)
|
/// Координата X объекта
|
||||||
|
/// </summary>
|
||||||
|
public int? GetPosX => _startPosX;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Координата Y объекта
|
||||||
|
/// </summary>
|
||||||
|
public int? GetPosY => _startPosY;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина объекта
|
||||||
|
/// </summary>
|
||||||
|
public int GetWidth => _drawningLocomotiveWidth;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Высота объекта
|
||||||
|
/// </summary>
|
||||||
|
public int GetHeight => _drawningLocomotiveHeight;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Пустой конструктор
|
||||||
|
/// </summary>
|
||||||
|
private DrawningLocomotive()
|
||||||
{
|
{
|
||||||
EntityWarmlyLocomotive = new EntityWarmlyLocomotive();
|
|
||||||
EntityWarmlyLocomotive.Init(speed, weight, bodyColor, additionalColor,
|
|
||||||
tube, fuelTank);
|
|
||||||
_pictureWidth = null;
|
_pictureWidth = null;
|
||||||
_pictureHeight = null;
|
_pictureHeight = null;
|
||||||
_startPosX = null;
|
_startPosX = null;
|
||||||
_startPosY = null;
|
_startPosY = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
|
public DrawningLocomotive(int speed, double weight, Color bodyColor) : this()
|
||||||
|
{
|
||||||
|
EntityLocomotive = new EntityLocomotive(speed, weight, bodyColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор для наследников
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="drawningLocomotiveWidth">Ширина прорисовки паровоза</param>
|
||||||
|
/// <param name="drawningLocomotiveHeight">Высота прорисовки паровоза</param>
|
||||||
|
protected DrawningLocomotive(int drawningLocomotiveWidth, int drawningLocomotiveHeight) : this()
|
||||||
|
{
|
||||||
|
_drawningLocomotiveWidth = drawningLocomotiveWidth;
|
||||||
|
_pictureHeight = drawningLocomotiveHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
//public void Init(int speed, double weight, Color bodyColor, Color
|
||||||
|
//additionalColor, bool tube, bool fuelTank)
|
||||||
|
//{
|
||||||
|
// EntityWarmlyLocomotive = new EntityWarmlyLocomotive();
|
||||||
|
// EntityWarmlyLocomotive.Init(speed, weight, bodyColor, additionalColor,
|
||||||
|
// tube, fuelTank);
|
||||||
|
// _pictureWidth = null;
|
||||||
|
// _pictureHeight = null;
|
||||||
|
// _startPosX = null;
|
||||||
|
// _startPosY = null;
|
||||||
|
//}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Установка границ поля
|
/// Установка границ поля
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -62,7 +116,7 @@ public class DrawningWarmlyLocomotive
|
|||||||
if (_startPosX != null && _startPosY != null)
|
if (_startPosX != null && _startPosY != null)
|
||||||
{
|
{
|
||||||
//проверка х
|
//проверка х
|
||||||
if ((_startPosX.Value + _drawningLocomotiveWidth) > _pictureWidth)
|
if (_startPosX.Value + _drawningLocomotiveWidth > _pictureWidth)
|
||||||
{
|
{
|
||||||
_startPosX = _pictureWidth - _drawningLocomotiveWidth;
|
_startPosX = _pictureWidth - _drawningLocomotiveWidth;
|
||||||
}
|
}
|
||||||
@ -72,7 +126,7 @@ public class DrawningWarmlyLocomotive
|
|||||||
}
|
}
|
||||||
|
|
||||||
//проверка у
|
//проверка у
|
||||||
if ((_startPosY.Value + _drawningLocomotiveHeight) > _pictureHeight)
|
if (_startPosY.Value + _drawningLocomotiveHeight > _pictureHeight)
|
||||||
{
|
{
|
||||||
_startPosY = _pictureHeight - _drawningLocomotiveHeight;
|
_startPosY = _pictureHeight - _drawningLocomotiveHeight;
|
||||||
}
|
}
|
||||||
@ -99,7 +153,7 @@ public class DrawningWarmlyLocomotive
|
|||||||
}
|
}
|
||||||
|
|
||||||
//проверка у
|
//проверка у
|
||||||
if ((y + _drawningLocomotiveHeight) > _pictureHeight)
|
if (y + _drawningLocomotiveHeight > _pictureHeight)
|
||||||
{
|
{
|
||||||
_startPosY = _pictureHeight - _drawningLocomotiveHeight;
|
_startPosY = _pictureHeight - _drawningLocomotiveHeight;
|
||||||
}
|
}
|
||||||
@ -113,7 +167,7 @@ public class DrawningWarmlyLocomotive
|
|||||||
}
|
}
|
||||||
|
|
||||||
//проверка х
|
//проверка х
|
||||||
if ((x + _drawningLocomotiveWidth) > _pictureWidth)
|
if (x + _drawningLocomotiveWidth > _pictureWidth)
|
||||||
{
|
{
|
||||||
_startPosX = _pictureWidth - _drawningLocomotiveWidth;
|
_startPosX = _pictureWidth - _drawningLocomotiveWidth;
|
||||||
}
|
}
|
||||||
@ -133,7 +187,7 @@ public class DrawningWarmlyLocomotive
|
|||||||
|
|
||||||
public bool MoveTransport(DirectionType direction)
|
public bool MoveTransport(DirectionType direction)
|
||||||
{
|
{
|
||||||
if (EntityWarmlyLocomotive == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
if (EntityLocomotive == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -141,30 +195,30 @@ public class DrawningWarmlyLocomotive
|
|||||||
{
|
{
|
||||||
//влево
|
//влево
|
||||||
case DirectionType.Left:
|
case DirectionType.Left:
|
||||||
if (_startPosX.Value - EntityWarmlyLocomotive.Step > 0)
|
if (_startPosX.Value - EntityLocomotive.Step > 0)
|
||||||
{
|
{
|
||||||
_startPosX -= (int)EntityWarmlyLocomotive.Step;
|
_startPosX -= (int)EntityLocomotive.Step;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
//вверх
|
//вверх
|
||||||
case DirectionType.Up:
|
case DirectionType.Up:
|
||||||
if (_startPosY.Value - EntityWarmlyLocomotive.Step > 0)
|
if (_startPosY.Value - EntityLocomotive.Step > 0)
|
||||||
{
|
{
|
||||||
_startPosY -= (int)EntityWarmlyLocomotive.Step;
|
_startPosY -= (int)EntityLocomotive.Step;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
// вправо
|
// вправо
|
||||||
case DirectionType.Right:
|
case DirectionType.Right:
|
||||||
if (_startPosX.Value + EntityWarmlyLocomotive.Step + _drawningLocomotiveWidth < _pictureWidth)
|
if (_startPosX.Value + EntityLocomotive.Step + _drawningLocomotiveWidth < _pictureWidth)
|
||||||
{
|
{
|
||||||
_startPosX += (int)EntityWarmlyLocomotive.Step;
|
_startPosX += (int)EntityLocomotive.Step;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
//вниз
|
//вниз
|
||||||
case DirectionType.Down:
|
case DirectionType.Down:
|
||||||
if (_startPosY.Value + EntityWarmlyLocomotive.Step + _drawningLocomotiveHeight < _pictureHeight)
|
if (_startPosY.Value + EntityLocomotive.Step + _drawningLocomotiveHeight < _pictureHeight)
|
||||||
{
|
{
|
||||||
_startPosY += (int)EntityWarmlyLocomotive.Step;
|
_startPosY += (int)EntityLocomotive.Step;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
@ -175,24 +229,25 @@ public class DrawningWarmlyLocomotive
|
|||||||
/// Прорисовка объекта
|
/// Прорисовка объекта
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
public void DrawTransport(Graphics g)
|
public virtual void DrawTransport(Graphics g)
|
||||||
{
|
{
|
||||||
if (EntityWarmlyLocomotive == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
if (EntityLocomotive == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Pen pen = new(Color.Black);
|
Pen pen = new(Color.Black);
|
||||||
Brush additionalBrush = new SolidBrush(EntityWarmlyLocomotive.AdditionalColor);
|
|
||||||
|
//Brush additionalBrush = new SolidBrush(EntityWarmlyLocomotive.AdditionalColor);
|
||||||
|
|
||||||
//труба
|
//труба
|
||||||
if (EntityWarmlyLocomotive.Tube)
|
//if (EntityWarmlyLocomotive.Tube)
|
||||||
{
|
//{
|
||||||
g.DrawRectangle(pen, _startPosX.Value + 40, _startPosY.Value, 20, 30);
|
// g.DrawRectangle(pen, _startPosX.Value + 40, _startPosY.Value, 20, 30);
|
||||||
g.FillRectangle(additionalBrush, _startPosX.Value + 40, _startPosY.Value, 20, 40);
|
// g.FillRectangle(additionalBrush, _startPosX.Value + 40, _startPosY.Value, 20, 40);
|
||||||
}
|
//}
|
||||||
|
|
||||||
//локомотив
|
//локомотив
|
||||||
Brush br = new SolidBrush(EntityWarmlyLocomotive.BodyColor);
|
Brush br = new SolidBrush(EntityLocomotive.BodyColor);
|
||||||
Brush blBr = new SolidBrush(Color.Black);
|
Brush blBr = new SolidBrush(Color.Black);
|
||||||
g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 60, 140, 20);
|
g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 60, 140, 20);
|
||||||
g.FillRectangle(br, _startPosX.Value, _startPosY.Value + 60, 140, 20);
|
g.FillRectangle(br, _startPosX.Value, _startPosY.Value + 60, 140, 20);
|
||||||
@ -200,11 +255,13 @@ public class DrawningWarmlyLocomotive
|
|||||||
Point point2 = new Point(_startPosX.Value + 20, _startPosY.Value + 30);
|
Point point2 = new Point(_startPosX.Value + 20, _startPosY.Value + 30);
|
||||||
Point point3 = new Point(_startPosX.Value + 140, _startPosY.Value + 30);
|
Point point3 = new Point(_startPosX.Value + 140, _startPosY.Value + 30);
|
||||||
Point point4 = new Point(_startPosX.Value + 140, _startPosY.Value + 60);
|
Point point4 = new Point(_startPosX.Value + 140, _startPosY.Value + 60);
|
||||||
Point[] body ={point1, point2, point3, point4};
|
Point[] body = { point1, point2, point3, point4 };
|
||||||
g.DrawPolygon(pen, body);
|
g.DrawPolygon(pen, body);
|
||||||
g.FillPolygon(br, body);
|
g.FillPolygon(br, body);
|
||||||
g.DrawRectangle(pen, _startPosX.Value + 140, _startPosY.Value + 40, 10, 40);
|
g.DrawRectangle(pen, _startPosX.Value + 140, _startPosY.Value + 40, 10, 40);
|
||||||
g.FillRectangle(br, _startPosX.Value + 140, _startPosY.Value + 40, 10, 40);
|
g.FillRectangle(br, _startPosX.Value + 140, _startPosY.Value + 40, 10, 40);
|
||||||
|
|
||||||
|
//колеса
|
||||||
g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 80, 20, 20);
|
g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 80, 20, 20);
|
||||||
g.FillEllipse(blBr, _startPosX.Value, _startPosY.Value + 80, 20, 20);
|
g.FillEllipse(blBr, _startPosX.Value, _startPosY.Value + 80, 20, 20);
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value + 80, 20, 20);
|
g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value + 80, 20, 20);
|
||||||
@ -215,11 +272,11 @@ public class DrawningWarmlyLocomotive
|
|||||||
g.FillEllipse(blBr, _startPosX.Value + 120, _startPosY.Value + 80, 20, 20);
|
g.FillEllipse(blBr, _startPosX.Value + 120, _startPosY.Value + 80, 20, 20);
|
||||||
|
|
||||||
// отсек для топлива
|
// отсек для топлива
|
||||||
if (EntityWarmlyLocomotive.FuelTank)
|
//if (EntityWarmlyLocomotive.FuelTank)
|
||||||
{
|
//{
|
||||||
g.DrawRectangle(pen, _startPosX.Value + 80, _startPosY.Value + 40, 50, 40);
|
// g.DrawRectangle(pen, _startPosX.Value + 80, _startPosY.Value + 40, 50, 40);
|
||||||
g.FillRectangle(additionalBrush, _startPosX.Value + 80, _startPosY.Value + 40, 50, 40);
|
// g.FillRectangle(additionalBrush, _startPosX.Value + 80, _startPosY.Value + 40, 50, 40);
|
||||||
}
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
44
WarmlyLocomotive/Drawnings/DrawningWarmlyLocomotive.cs
Normal file
44
WarmlyLocomotive/Drawnings/DrawningWarmlyLocomotive.cs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
using WarmlyLocomotive.Entities;
|
||||||
|
|
||||||
|
namespace WarmlyLocomotive.Drawnings;
|
||||||
|
/// <summary>
|
||||||
|
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
||||||
|
/// </summary>
|
||||||
|
public class DrawningWarmlyLocomotive : DrawningLocomotive
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Класс-сущность
|
||||||
|
/// </summary>
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
43
WarmlyLocomotive/Entities/EntityLocomotive.cs
Normal file
43
WarmlyLocomotive/Entities/EntityLocomotive.cs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WarmlyLocomotive.Entities;
|
||||||
|
/// <summary>
|
||||||
|
/// Базовый класс сущности
|
||||||
|
/// </summary>
|
||||||
|
public class EntityLocomotive
|
||||||
|
{
|
||||||
|
public int Speed { get; private set; }
|
||||||
|
|
||||||
|
public double Weight { get; private set; }
|
||||||
|
|
||||||
|
public Color BodyColor { get; private set; }
|
||||||
|
|
||||||
|
//public Color AdditionalColor { get; private set; }
|
||||||
|
|
||||||
|
//public bool Tube { get; private set; }
|
||||||
|
|
||||||
|
//public bool FuelTank { get; private set; }
|
||||||
|
|
||||||
|
public double Step => Speed * 100 / Weight;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор, заменяющий init
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">скорость</param>
|
||||||
|
/// <param name="weight">вес</param>
|
||||||
|
/// <param name="bodyColor">цвет</param>
|
||||||
|
public EntityLocomotive(int speed, double weight, Color bodyColor)
|
||||||
|
{
|
||||||
|
Speed = speed;
|
||||||
|
Weight = weight;
|
||||||
|
BodyColor = bodyColor;
|
||||||
|
//AdditionalColor = additionalColor;
|
||||||
|
//Tube = tube;
|
||||||
|
//FuelTank = fuelTank;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
21
WarmlyLocomotive/Entities/EntityWarmlyLocomotive.cs
Normal file
21
WarmlyLocomotive/Entities/EntityWarmlyLocomotive.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WarmlyLocomotive.Entities;
|
||||||
|
public class EntityWarmlyLocomotive : EntityLocomotive
|
||||||
|
{
|
||||||
|
public Color AdditionalColor { get; private set; }
|
||||||
|
public bool Tube;
|
||||||
|
public bool FuelTank;
|
||||||
|
|
||||||
|
public EntityWarmlyLocomotive(int speed, double weight, Color bodyColor, Color additionalColor, bool tube, bool fuelTank) : base(speed, weight, bodyColor)
|
||||||
|
{
|
||||||
|
AdditionalColor = additionalColor;
|
||||||
|
Tube = tube;
|
||||||
|
FuelTank = fuelTank;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,38 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net.NetworkInformation;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace WarmlyLocomotive;
|
|
||||||
|
|
||||||
public class EntityWarmlyLocomotive
|
|
||||||
{
|
|
||||||
public int Speed { get; private set; }
|
|
||||||
|
|
||||||
public double Weight { get; private set; }
|
|
||||||
|
|
||||||
public Color BodyColor { get; private set; }
|
|
||||||
|
|
||||||
public Color AdditionalColor { get; private set; }
|
|
||||||
|
|
||||||
public bool Tube { get; private set; }
|
|
||||||
|
|
||||||
public bool FuelTank { get; private set; }
|
|
||||||
|
|
||||||
public double Step => Speed * 100 / Weight;
|
|
||||||
|
|
||||||
|
|
||||||
public void Init(int speed, double weight, Color bodyColor, Color
|
|
||||||
additionalColor, bool tube, bool fuelTank)
|
|
||||||
{
|
|
||||||
Speed = speed;
|
|
||||||
Weight = weight;
|
|
||||||
BodyColor = bodyColor;
|
|
||||||
AdditionalColor = additionalColor;
|
|
||||||
Tube = tube;
|
|
||||||
FuelTank = fuelTank;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -7,6 +7,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using WarmlyLocomotive.Drawnings;
|
||||||
|
|
||||||
namespace WarmlyLocomotive
|
namespace WarmlyLocomotive
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user