diff --git a/ProjectBulldozer/ProjectBulldozer/CollectionGenericObjects/Garage.cs b/ProjectBulldozer/ProjectBulldozer/CollectionGenericObjects/Garage.cs
index 8583f11..1e25e8d 100644
--- a/ProjectBulldozer/ProjectBulldozer/CollectionGenericObjects/Garage.cs
+++ b/ProjectBulldozer/ProjectBulldozer/CollectionGenericObjects/Garage.cs
@@ -31,7 +31,7 @@ public class Garage : AbstractCompany
{
int cntVertically = _pictureHeight / _placeSizeHeight; //Колличество мест по вертикали
int cntHorizontally = _pictureWidth / _placeSizeWidth; //Колличество мест по горизонтали
- Pen pen = new Pen(Color.FromArgb(0, 0, 0));
+ Pen pen = new Pen(Color.FromArgb(185, 140, 0));
pen.Width = 3;
for (int i = 0; i < cntHorizontally; i++)
diff --git a/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawningBulldozer.cs b/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawningBulldozer.cs
index fd24cf3..49f71ab 100644
--- a/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawningBulldozer.cs
+++ b/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawningBulldozer.cs
@@ -35,7 +35,7 @@ public class DrawningBulldozer : DrawningDozer
Pen pen = new(Color.Black);
Brush bodyBrush = new SolidBrush(EntityDozer.BodyColor);
- Brush additionalBrush = new SolidBrush(EntityDozer.AdditionalColor);
+ Brush additionalBrush = new SolidBrush(bulldozer.AdditionalColor);
//BULDOZER
_startPosX += 0;
_startPosY += 0;
diff --git a/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawningDozer.cs b/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawningDozer.cs
index 5d45b56..4715602 100644
--- a/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawningDozer.cs
+++ b/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawningDozer.cs
@@ -86,9 +86,9 @@ public class DrawningDozer
/// Вес
/// Основной цвет
/// Дополнительный цвет(цвет колёс)
- public DrawningDozer(int speed, double weight, Color bodyColor, Color additionalColor) : this()
+ public DrawningDozer(int speed, double weight, Color bodyColor) : this()
{
- EntityDozer = new EntityDozer(speed, weight, bodyColor, additionalColor);
+ EntityDozer = new EntityDozer(speed, weight, bodyColor);
}
///
@@ -99,9 +99,7 @@ public class DrawningDozer
protected DrawningDozer (int drawningBulldozerWidth, int drawningBulldozerHeigh) :this()
{
_drawningBulldozerWidth = drawningBulldozerWidth;
- //????????
_pictureHeight = drawningBulldozerHeigh;
- //????????
}
///
@@ -245,19 +243,19 @@ public class DrawningDozer
Pen pen = new(Color.Black);
Brush bodyBrush = new SolidBrush(EntityDozer.BodyColor);
- Brush additionalBrush = new SolidBrush(EntityDozer.AdditionalColor);
+ Brush wheelsBrush = new SolidBrush(Color.FromArgb(60, 60, 60));
//BULDOZER
//body
g.FillRectangle(bodyBrush, _startPosX.Value + 10, _startPosY.Value + 15, _drawningBulldozerWidth - 20, _drawningBulldozerHeight - 30);
g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 15, _drawningBulldozerWidth - 20, _drawningBulldozerHeight - 30);
//wheels
- g.FillRectangle(additionalBrush, _startPosX.Value, _startPosY.Value + _drawningBulldozerHeight - 15, 50, 15);
+ g.FillRectangle(wheelsBrush, _startPosX.Value, _startPosY.Value + _drawningBulldozerHeight - 15, 50, 15);
g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + _drawningBulldozerHeight - 15, 50, 15);
- g.FillRectangle(additionalBrush, _startPosX.Value + _drawningBulldozerWidth - 50, _startPosY.Value + _drawningBulldozerHeight - 15, 50, 15);
+ g.FillRectangle(wheelsBrush, _startPosX.Value + _drawningBulldozerWidth - 50, _startPosY.Value + _drawningBulldozerHeight - 15, 50, 15);
g.DrawRectangle(pen, _startPosX.Value + _drawningBulldozerWidth - 50, _startPosY.Value + _drawningBulldozerHeight - 15, 50, 15);
- g.FillRectangle(additionalBrush, _startPosX.Value, _startPosY.Value, 50, 15);
+ g.FillRectangle(wheelsBrush, _startPosX.Value, _startPosY.Value, 50, 15);
g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value, 50, 15);
- g.FillRectangle(additionalBrush, _startPosX.Value + _drawningBulldozerWidth - 50, _startPosY.Value, 50, 15);
+ g.FillRectangle(wheelsBrush, _startPosX.Value + _drawningBulldozerWidth - 50, _startPosY.Value, 50, 15);
g.DrawRectangle(pen, _startPosX.Value + _drawningBulldozerWidth - 50, _startPosY.Value, 50, 15);
//strange rectangles
g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 25, 3, _drawningBulldozerHeight - 50);
diff --git a/ProjectBulldozer/ProjectBulldozer/Entities/EntityBulldozer.cs b/ProjectBulldozer/ProjectBulldozer/Entities/EntityBulldozer.cs
index db024f8..cfce915 100644
--- a/ProjectBulldozer/ProjectBulldozer/Entities/EntityBulldozer.cs
+++ b/ProjectBulldozer/ProjectBulldozer/Entities/EntityBulldozer.cs
@@ -22,28 +22,25 @@ public class EntityBulldozer : EntityDozer
/// Признак (опция) наличие гусеницы
///
public bool Caterpillar { get; private set; }
-/*
+
+
///
- /// Шаг перемещения бульдозера
+ /// Дополнительный цвет
///
- public double Step => Speed * 100 / Weight;*/
-/*
- ///
- ///Инициализация полей объекта-класса бульдозера
- ///
- ///Скорость
- ///Вес
- ///Основной цвет
- ///Дополнительный цвет
- ///Признак наличия отвала
- ///Признак наличия гусеницы
- public void EntityBulldozer(bool blade, bool caterpillar) base(speed, )
- {
- Blade = blade;
- Caterpillar = caterpillar;
- }*/
- public EntityBulldozer(int speed, double weight, Color bodyColor, Color additionalColor, bool blade, bool caterpillar) : base(speed, weight, bodyColor, additionalColor)
+ public Color AdditionalColor { get; private set; }
+
+ ///
+ ///Инициализация полей объекта-класса бульдозера
+ ///
+ ///Скорость
+ ///Вес
+ ///Основной цвет
+ ///Дополнительный цвет
+ ///Признак наличия отвала
+ ///Признак наличия гусеницы
+ public EntityBulldozer(int speed, double weight, Color bodyColor, Color additionalColor, bool blade, bool caterpillar) : base(speed, weight, bodyColor)
{
+ AdditionalColor = additionalColor;
Blade = blade;
Caterpillar = caterpillar;
}
diff --git a/ProjectBulldozer/ProjectBulldozer/Entities/EntityDozer.cs b/ProjectBulldozer/ProjectBulldozer/Entities/EntityDozer.cs
index 89ec3e7..d78fe16 100644
--- a/ProjectBulldozer/ProjectBulldozer/Entities/EntityDozer.cs
+++ b/ProjectBulldozer/ProjectBulldozer/Entities/EntityDozer.cs
@@ -26,11 +26,6 @@ public class EntityDozer
///
public Color BodyColor { get; private set; }
- ///
- /// Дополнительный цвет
- ///
- public Color AdditionalColor { get; private set; }
-
///
/// Шаг перемещения бульдозера
///
@@ -42,13 +37,11 @@ public class EntityDozer
///Скорость
///Вес
///Основной цвет
- ///Дополнительный цвет
- public EntityDozer(int speed, double weight, Color bodyColor, Color additionalColor)
+ public EntityDozer(int speed, double weight, Color bodyColor/*, Color additionalColor*/)
{
Speed = speed;
Weight = weight;
BodyColor = bodyColor;
- AdditionalColor = additionalColor;
}
}
diff --git a/ProjectBulldozer/ProjectBulldozer/FormBulldozerCollection.cs b/ProjectBulldozer/ProjectBulldozer/FormBulldozerCollection.cs
index b485011..6e42ba8 100644
--- a/ProjectBulldozer/ProjectBulldozer/FormBulldozerCollection.cs
+++ b/ProjectBulldozer/ProjectBulldozer/FormBulldozerCollection.cs
@@ -89,14 +89,13 @@ public partial class FormBulldozerCollection : Form
{
case nameof(DrawningDozer):
drawningDozer = new DrawningDozer(random.Next(100, 300), random.Next(1000, 3000),
- GetBodyColor(random), Color.FromArgb(random.Next(30, 120), random.Next(30, 120), random.Next(30, 120)));
+ GetBodyColor(random));
break;
case nameof(DrawningBulldozer):
- //TODO вызов диалогового окна для выбора цвета
+ //Вызов диалогового окна для выбора цвета
drawningDozer = new DrawningBulldozer(random.Next(100, 300), random.Next(1000, 3000),
- Color.FromArgb(random.Next(170, 256), random.Next(170, 256), random.Next(30, 140)),
- Color.FromArgb(random.Next(30, 120), random.Next(30, 120), random.Next(30, 120)),
- Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
+ GetBodyColor(random), GetWheelsColor(random),
+ Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
break;
default:
return;
@@ -114,7 +113,7 @@ public partial class FormBulldozerCollection : Form
}
///
- /// Получение цвета самого бульдозера
+ /// Получение цвета корпуса бульдозера
///
/// Генератор случайных чисел
///
@@ -129,6 +128,22 @@ public partial class FormBulldozerCollection : Form
return color;
}
+ ///
+ /// Получение цвета гусеницы бульдозера
+ ///
+ /// Генератор случайных чисел
+ ///
+ private static Color GetWheelsColor(Random random)
+ {
+ Color color = Color.FromArgb(random.Next(30, 120), random.Next(30, 120), random.Next(30, 120));
+ ColorDialog dialog = new();
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ color = dialog.Color;
+ }
+ return color;
+ }
+
///
/// Удаление объекта
///