diff --git a/ProjectTank/ProjectTank/Direction.cs b/ProjectTank/ProjectTank/DirectionType.cs
similarity index 100%
rename from ProjectTank/ProjectTank/Direction.cs
rename to ProjectTank/ProjectTank/DirectionType.cs
diff --git a/ProjectTank/ProjectTank/DrawningTank.cs b/ProjectTank/ProjectTank/DrawningTank.cs
index e9a7bb7..5b430c7 100644
--- a/ProjectTank/ProjectTank/DrawningTank.cs
+++ b/ProjectTank/ProjectTank/DrawningTank.cs
@@ -13,6 +13,7 @@ namespace ProjectTank
/// Класс-сущность
///
public EntityTank? _EntityTank { get; private set; }
+ public DrawningWheelers? DrawningWheelersVariation;
///
/// Ширина окна
///
@@ -48,7 +49,7 @@ namespace ProjectTank
/// Высота картинки
/// true - объект создан, false - проверка не пройдена,нельзя создать объект в этих размерах
public bool Init(int speed, double weight, Color bodyColor, Color additionalColor,
- bool gun, bool machineGun, int width, int height)
+ bool gun, bool machineGun, int width, int height, int _numWheelers)
{
_pictureWidth = width;
_pictureHeight = height;
@@ -58,7 +59,9 @@ namespace ProjectTank
return false;
}
_EntityTank = new EntityTank();
- _EntityTank.Init(speed, weight, gun, machineGun, bodyColor, additionalColor);
+ _EntityTank.Init(speed, weight, gun, machineGun, bodyColor, additionalColor, _numWheelers);
+ DrawningWheelersVariation = new DrawningWheelers();
+ DrawningWheelersVariation.SomeProperty = _numWheelers;
return true;
}
///
@@ -132,7 +135,6 @@ namespace ProjectTank
return;
}
Pen pen = new(Color.Black, 3);
- Pen penGray = new(Color.Gray, 4);
Brush grayColorBrush = new SolidBrush(Color.Gray);
Brush blackColorBrush = new SolidBrush(Color.Black);
Brush additionalBrush = new SolidBrush(_EntityTank.AdditionalColor);
@@ -142,14 +144,11 @@ namespace ProjectTank
// гусеницы
g.DrawEllipse(pen, _startPosX+14, _startPosY+44, 151, 31);
g.FillEllipse(blackColorBrush, _startPosX + 15, _startPosY + 45, 150, 30);
- g.DrawEllipse(penGray, _startPosX + 24, _startPosY + 54, 10, 10);
- g.DrawEllipse(penGray, _startPosX + 144, _startPosY + 54, 10, 10);
- g.DrawEllipse(penGray, _startPosX + 44, _startPosY + 59, 10, 10);
- g.DrawEllipse(penGray, _startPosX + 124, _startPosY + 59, 10, 10);
- g.DrawEllipse(penGray, _startPosX + 64, _startPosY + 61, 10, 10);
- g.DrawEllipse(penGray, _startPosX + 104, _startPosY + 61, 10, 10);
- g.DrawEllipse(penGray, _startPosX + 84, _startPosY + 62, 10, 10);
- // Кузов
+
+ //катки
+ DrawningWheelersVariation.Draw(_startPosX, _startPosY, g);
+
+ // Кузов
g.DrawRectangle(pen, _startPosX + 19, _startPosY + 34, 141, 21);
g.FillRectangle(bodyBrush, _startPosX+20, _startPosY+35, 140, 20);
diff --git a/ProjectTank/ProjectTank/DrawningWheelers.cs b/ProjectTank/ProjectTank/DrawningWheelers.cs
new file mode 100644
index 0000000..8dc41ef
--- /dev/null
+++ b/ProjectTank/ProjectTank/DrawningWheelers.cs
@@ -0,0 +1,67 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Cryptography;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectTank
+{
+ public class DrawningWheelers
+ {
+ private WheelersDirection numWheelers;
+
+ public int? SomeProperty
+ {
+ set
+ {
+ switch (value)
+ {
+ case 4:
+ numWheelers = WheelersDirection.FourthWheelers;
+ break;
+ case 5:
+ numWheelers = WheelersDirection.FifthWheelers;
+ break;
+ case 6:
+ numWheelers = WheelersDirection.SixthWheelers;
+ break;
+ default:
+ numWheelers = WheelersDirection.FourthWheelers;
+ MessageBox.Show("Неверное количество катков!");
+ break;
+ }
+
+ }
+ }
+ public void Draw(int _startPosX, int _startPosY, Graphics g)
+ {
+ Pen penGray = new(Color.Gray, 4);
+ if (numWheelers == WheelersDirection.FourthWheelers)
+ {
+ g.DrawEllipse(penGray, _startPosX + 24, _startPosY + 54, 10, 10);
+ g.DrawEllipse(penGray, _startPosX + 64, _startPosY + 59, 10, 10);
+ g.DrawEllipse(penGray, _startPosX + 104, _startPosY + 59, 10, 10);
+ g.DrawEllipse(penGray, _startPosX + 144, _startPosY + 54, 10, 10);
+ }
+ if (numWheelers == WheelersDirection.FifthWheelers)
+ {
+ g.DrawEllipse(penGray, _startPosX + 24, _startPosY + 54, 10, 10);
+ g.DrawEllipse(penGray, _startPosX + 54, _startPosY + 59, 10, 10);
+ g.DrawEllipse(penGray, _startPosX + 84, _startPosY + 61, 10, 10);
+ g.DrawEllipse(penGray, _startPosX + 114, _startPosY + 59, 10, 10);
+ g.DrawEllipse(penGray, _startPosX + 144, _startPosY + 54, 10, 10);
+ }
+ if (numWheelers == WheelersDirection.SixthWheelers)
+ {
+ g.DrawEllipse(penGray, _startPosX + 24, _startPosY + 54, 10, 10);
+ g.DrawEllipse(penGray, _startPosX + 48, _startPosY + 59, 10, 10);
+ g.DrawEllipse(penGray, _startPosX + 72, _startPosY + 61, 10, 10);
+ g.DrawEllipse(penGray, _startPosX + 96, _startPosY + 61, 10, 10);
+ g.DrawEllipse(penGray, _startPosX + 120, _startPosY + 59, 10, 10);
+ g.DrawEllipse(penGray, _startPosX + 144, _startPosY + 54, 10, 10);
+ }
+
+ }
+ }
+}
diff --git a/ProjectTank/ProjectTank/EntityTank.cs b/ProjectTank/ProjectTank/EntityTank.cs
index 910b1b3..f4db131 100644
--- a/ProjectTank/ProjectTank/EntityTank.cs
+++ b/ProjectTank/ProjectTank/EntityTank.cs
@@ -37,6 +37,7 @@ namespace ProjectTank
/// Дополнительный цвет (для опциональных элементов)
///
public Color AdditionalColor { get; private set; }
+ public int NumWheelers { get; private set; }
///
/// Расчет шага по карте
@@ -54,7 +55,7 @@ namespace ProjectTank
/// Признак наличия пулемета
///
public void Init(int speed, double weight, bool gun,
- bool machineGun, Color bodyColor, Color additionalColor)
+ bool machineGun, Color bodyColor, Color additionalColor, int numWheelers)
{
Speed = speed;
Weight = weight;
@@ -62,6 +63,7 @@ namespace ProjectTank
AdditionalColor = additionalColor;
Gun = gun;
MachineGun = machineGun;
+ NumWheelers= numWheelers;
}
}
}
diff --git a/ProjectTank/ProjectTank/TankForm.cs b/ProjectTank/ProjectTank/TankForm.cs
index 44712a2..33fb4df 100644
--- a/ProjectTank/ProjectTank/TankForm.cs
+++ b/ProjectTank/ProjectTank/TankForm.cs
@@ -44,7 +44,7 @@ namespace ProjectTank
_drawningTank.Init(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)),
- pictureBoxTanks.Width, pictureBoxTanks.Height);
+ pictureBoxTanks.Width, pictureBoxTanks.Height, random.Next(4, 7));
_drawningTank.SetPosition(random.Next(0, 100), random.Next(0, 100));
Draw();
}
diff --git a/ProjectTank/ProjectTank/WheelersDirection.cs b/ProjectTank/ProjectTank/WheelersDirection.cs
new file mode 100644
index 0000000..a84e94e
--- /dev/null
+++ b/ProjectTank/ProjectTank/WheelersDirection.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectTank
+{
+ public enum WheelersDirection
+ {
+ ///
+ /// Четыре катка
+ ///
+ FourthWheelers,
+ ///
+ /// Пять катков
+ ///
+ FifthWheelers,
+ ///
+ /// Шесть катков
+ ///
+ SixthWheelers
+ }
+}