diff --git a/ElectricLocomotive/ElectricLocomotive/BushesMap.cs b/ElectricLocomotive/ElectricLocomotive/BushesMap.cs
index 376a534..66179d0 100644
--- a/ElectricLocomotive/ElectricLocomotive/BushesMap.cs
+++ b/ElectricLocomotive/ElectricLocomotive/BushesMap.cs
@@ -8,13 +8,8 @@ namespace ElectricLocomotive
{
internal class BushesMap : AbstractMap
{
- ///
- /// Цвет участка закрытого
- ///
+
private readonly Pen barrierColor = new Pen(Color.DarkGreen, 3);
- ///
- /// Цвет участка открытого
- ///
private readonly Brush roadColor = new SolidBrush(Color.Brown);
protected override void DrawBarrierPart(Graphics g, int i, int j)
diff --git a/ElectricLocomotive/ElectricLocomotive/DrawningHardLocomotive.cs b/ElectricLocomotive/ElectricLocomotive/DrawningElectricLocomotive.cs
similarity index 57%
rename from ElectricLocomotive/ElectricLocomotive/DrawningHardLocomotive.cs
rename to ElectricLocomotive/ElectricLocomotive/DrawningElectricLocomotive.cs
index 0cf6419..f43a454 100644
--- a/ElectricLocomotive/ElectricLocomotive/DrawningHardLocomotive.cs
+++ b/ElectricLocomotive/ElectricLocomotive/DrawningElectricLocomotive.cs
@@ -6,31 +6,20 @@ using System.Threading.Tasks;
namespace ElectricLocomotive
{
- internal class DrawningHardLocomotive : DrawningLocomotive
+ internal class DrawningElectricLocomotive : DrawningLocomotive
{
- ///
- /// Инициализация свойств
- ///
- /// Скорость
- /// Вес автомобиля
- /// Цвет кузова
- /// Дополнительный цвет
- /// Признак наличия обвеса
- /// Признак наличия антикрыла
- /// Признак наличия гоночной полосы
- public DrawningHardLocomotive(int speed, float weight, Color bodyColor, Color dopColor, bool bodyKit, bool wing, bool sportLine) :
+ public DrawningElectricLocomotive(int speed, float weight, Color bodyColor, Color dopColor, bool bodyKit, bool wing, bool sportLine) :
base(speed, weight, bodyColor, 110, 60)
{
- Locomotive = new EntityHardLocomotive(speed, weight, bodyColor, dopColor, bodyKit, wing, sportLine);
+ Locomotive = new EntityElectricLocomotive(speed, weight, bodyColor, dopColor, bodyKit, wing, sportLine);
}
public override void DrawTransport(Graphics g)
{
- if (Locomotive is not EntityHardLocomotive sportCar)
+ if (Locomotive is not EntityElectricLocomotive sportCar)
{
return;
}
-
Pen pen = new(Color.Black);
Pen window = new(Color.Blue);
Brush dopBrush = new SolidBrush(sportCar.DopColor);
diff --git a/ElectricLocomotive/ElectricLocomotive/DrawningLocomotive.cs b/ElectricLocomotive/ElectricLocomotive/DrawningLocomotive.cs
index 18e2bb8..48f0f2c 100644
--- a/ElectricLocomotive/ElectricLocomotive/DrawningLocomotive.cs
+++ b/ElectricLocomotive/ElectricLocomotive/DrawningLocomotive.cs
@@ -82,12 +82,6 @@ namespace ElectricLocomotive
_locomotiveWidth = locomotiveWidth;
_locomotiveHeight = locomotiveHeight;
}
- ///
-
- ///
- /// Отрисовка автомобиля
- ///
- ///
public virtual void DrawTransport(Graphics g)
{
if (_startPosX < 0 || _startPosY < 0
@@ -133,11 +127,6 @@ namespace ElectricLocomotive
g.DrawPolygon(pen, new Point[] { new Point(Convert.ToInt32(_startPosX) + 10, Convert.ToInt32(_startPosY) + 60), new Point(Convert.ToInt32(_startPosX) + 10, Convert.ToInt32(_startPosY) + 10), new Point(Convert.ToInt32(_startPosX) + 110, Convert.ToInt32(_startPosY) + 10), new Point(Convert.ToInt32(_startPosX) + 140, Convert.ToInt32(_startPosY) + 30), new Point(Convert.ToInt32(_startPosX) + 140, Convert.ToInt32(_startPosY) + 60) });
}
- ///
- /// Смена границ формы отрисовки
- ///
- /// Ширина картинки
- /// Высота картинки
public void ChangeBorders(int width, int height)
{
_pictureWidth = width;
@@ -157,10 +146,6 @@ namespace ElectricLocomotive
_startPosY = _pictureHeight.Value - _locomotiveHeight;
}
}
- ///
- /// Получение текущей позиции объекта
- ///
- ///
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
{
return (_startPosX, _startPosY, _startPosX + _locomotiveWidth, _startPosY + _locomotiveHeight);
diff --git a/ElectricLocomotive/ElectricLocomotive/DrawningObjectLocomotive.cs b/ElectricLocomotive/ElectricLocomotive/DrawningObjectLocomotive.cs
index 17b1063..5bf23d0 100644
--- a/ElectricLocomotive/ElectricLocomotive/DrawningObjectLocomotive.cs
+++ b/ElectricLocomotive/ElectricLocomotive/DrawningObjectLocomotive.cs
@@ -34,7 +34,6 @@ namespace ElectricLocomotive
void IDrawningObject.DrawningObject(Graphics g)
{
- // TODO
_locomotive.DrawTransport(g);
}
}
diff --git a/ElectricLocomotive/ElectricLocomotive/EntityElectricLocomotive.cs b/ElectricLocomotive/ElectricLocomotive/EntityElectricLocomotive.cs
new file mode 100644
index 0000000..1eb3518
--- /dev/null
+++ b/ElectricLocomotive/ElectricLocomotive/EntityElectricLocomotive.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ElectricLocomotive
+{
+ internal class EntityElectricLocomotive : EntityLocomotive
+ {
+ public Color DopColor { get; private set; }
+ public bool BodyKit { get; private set; }
+ public bool Wing { get; private set; }
+ public bool SportLine { get; private set; }
+ public EntityElectricLocomotive(int speed, float weight, Color bodyColor, Color dopColor, bool bodyKit, bool wing, bool sportLine) :
+ base(speed, weight, bodyColor)
+ {
+ DopColor = dopColor;
+ BodyKit = bodyKit;
+ Wing = wing;
+ SportLine = sportLine;
+ }
+ }
+}
diff --git a/ElectricLocomotive/ElectricLocomotive/EntityHardLocomotive.cs b/ElectricLocomotive/ElectricLocomotive/EntityHardLocomotive.cs
deleted file mode 100644
index df7e554..0000000
--- a/ElectricLocomotive/ElectricLocomotive/EntityHardLocomotive.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ElectricLocomotive
-{
- internal class EntityHardLocomotive : EntityLocomotive
- {
- ///
- /// Дополнительный цвет
- ///
- public Color DopColor { get; private set; }
- ///
- /// Признак наличия обвеса
- ///
- public bool BodyKit { get; private set; }
- ///
- /// Признак наличия антикрыла
- ///
- public bool Wing { get; private set; }
- ///
- /// Признак наличия гоночной полосы
- ///
- public bool SportLine { get; private set; }
- ///
- /// Инициализация свойств
- ///
- /// Скорость
- /// Вес автомобиля
- /// Цвет кузова
- /// Дополнительный цвет
- /// Признак наличия обвеса
- /// Признак наличия антикрыла
- /// Признак наличия гоночной полосы
- public EntityHardLocomotive(int speed, float weight, Color bodyColor, Color dopColor, bool bodyKit, bool wing, bool sportLine) :
- base(speed, weight, bodyColor)
- {
- DopColor = dopColor;
- BodyKit = bodyKit;
- Wing = wing;
- SportLine = sportLine;
- }
- }
-}
diff --git a/ElectricLocomotive/ElectricLocomotive/EntityLocomotive.cs b/ElectricLocomotive/ElectricLocomotive/EntityLocomotive.cs
index fa6e8ff..dca2328 100644
--- a/ElectricLocomotive/ElectricLocomotive/EntityLocomotive.cs
+++ b/ElectricLocomotive/ElectricLocomotive/EntityLocomotive.cs
@@ -9,29 +9,10 @@ namespace ElectricLocomotive
{
internal class EntityLocomotive
{
- ///
- /// Скорость
- ///
public int Speed { get; private set; }
- ///
- /// Вес
- ///
public float Weight { get; private set; }
- ///
- /// Цвет кузова
- ///
public Color BodyColor { get; private set; }
- ///
- /// Шаг перемещения автомобиля
- ///
public float Step => Speed * 100 / Weight;
- ///
- /// Инициализация полей объекта-класса автомобиля
- ///
- ///
- ///
- ///
- ///
public EntityLocomotive(int speed, float weight, Color bodyColor)
{
Random rnd = new Random();
diff --git a/ElectricLocomotive/ElectricLocomotive/FieldMap.cs b/ElectricLocomotive/ElectricLocomotive/FieldMap.cs
index adb5115..06d2ad0 100644
--- a/ElectricLocomotive/ElectricLocomotive/FieldMap.cs
+++ b/ElectricLocomotive/ElectricLocomotive/FieldMap.cs
@@ -8,13 +8,7 @@ namespace ElectricLocomotive
{
internal class FieldMap : AbstractMap
{
- ///
- /// Цвет участка закрытого
- ///
private readonly Brush barrierColor = new SolidBrush(Color.Brown);
- ///
- /// Цвет участка открытого
- ///
private readonly Brush roadColor = new SolidBrush(Color.Green);
protected override void DrawBarrierPart(Graphics g, int i, int j)
diff --git a/ElectricLocomotive/ElectricLocomotive/FormLocomotive.cs b/ElectricLocomotive/ElectricLocomotive/FormLocomotive.cs
index fc487dc..f6c1309 100644
--- a/ElectricLocomotive/ElectricLocomotive/FormLocomotive.cs
+++ b/ElectricLocomotive/ElectricLocomotive/FormLocomotive.cs
@@ -87,7 +87,7 @@ namespace ElectricLocomotive
private void ButtonCreateModif_Click(object sender, EventArgs e)
{
Random rnd = new();
- _locomotive = new DrawningHardLocomotive(rnd.Next(100, 300), rnd.Next(1000, 2000),
+ _locomotive = new DrawningElectricLocomotive(rnd.Next(100, 300), rnd.Next(1000, 2000),
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)),
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)),
Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)));
diff --git a/ElectricLocomotive/ElectricLocomotive/FormMap.cs b/ElectricLocomotive/ElectricLocomotive/FormMap.cs
index 11a83fb..546a435 100644
--- a/ElectricLocomotive/ElectricLocomotive/FormMap.cs
+++ b/ElectricLocomotive/ElectricLocomotive/FormMap.cs
@@ -73,7 +73,7 @@ namespace ElectricLocomotive
private void ButtonCreateModif_Click(object sender, EventArgs e)
{
Random rnd = new();
- var car = new DrawningHardLocomotive(rnd.Next(100, 300), rnd.Next(1000, 2000),
+ var car = new DrawningElectricLocomotive(rnd.Next(100, 300), rnd.Next(1000, 2000),
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)),
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)),
Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)));
diff --git a/ElectricLocomotive/ElectricLocomotive/IDrawningObject.cs b/ElectricLocomotive/ElectricLocomotive/IDrawningObject.cs
index 2b16a23..651fedd 100644
--- a/ElectricLocomotive/ElectricLocomotive/IDrawningObject.cs
+++ b/ElectricLocomotive/ElectricLocomotive/IDrawningObject.cs
@@ -8,33 +8,10 @@ namespace ElectricLocomotive
{
internal interface IDrawningObject
{
- ///
- /// Шаг перемещения объекта
- ///
public float Step { get; }
- ///
- /// Установка позиции объекта
- ///
- /// Координата X
- /// Координата Y
- /// Ширина полотна
- /// Высота полотна
void SetObject(int x, int y, int width, int height);
- ///
- /// Изменение направления пермещения объекта
- ///
- /// Направление
- ///
void MoveObject(Direction direction);
- ///
- /// Отрисовка объекта
- ///
- ///
void DrawningObject(Graphics g);
- ///
- /// Получение текущей позиции объекта
- ///
- ///
(float Left, float Right, float Top, float Bottom) GetCurrentPosition();
}
}
diff --git a/ElectricLocomotive/ElectricLocomotive/SimpleMap.cs b/ElectricLocomotive/ElectricLocomotive/SimpleMap.cs
index 6bce679..8fde87a 100644
--- a/ElectricLocomotive/ElectricLocomotive/SimpleMap.cs
+++ b/ElectricLocomotive/ElectricLocomotive/SimpleMap.cs
@@ -8,13 +8,7 @@ namespace ElectricLocomotive
{
internal class SimpleMap : AbstractMap
{
- ///
- /// Цвет участка закрытого
- ///
private readonly Brush barrierColor = new SolidBrush(Color.Black);
- ///
- /// Цвет участка открытого
- ///
private readonly Brush roadColor = new SolidBrush(Color.Gray);
protected override void DrawBarrierPart(Graphics g, int i, int j)