diff --git a/solution/lab1/DrawningEntityFighter.cs b/solution/lab1/DrawningEntityFighter.cs
deleted file mode 100644
index 82af208..0000000
--- a/solution/lab1/DrawningEntityFighter.cs
+++ /dev/null
@@ -1,241 +0,0 @@
-namespace lab1;
-
-///
-/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
-///
-public class DrawningEntityFighter
-{
- ///
- /// Класс-сущность
- ///
- public EntityFighter? EntityFighter { get; private set; }
-
- ///
- /// Ширина окна
- ///
- private int? _pictureWidth;
-
- ///
- /// Высота окна
- ///
- private int? _pictureHeight;
-
- ///
- /// Левая координата прорисовки истребителя
- ///
- private int? _startPosX;
-
- ///
- /// Верхняя координата прорисовки истребителя
- ///
- private int? _startPosY;
-
- ///
- /// Ширина прорисовки истребителя
- ///
- private readonly int _drawningFighterWidth = 91;
-
- ///
- /// Высота прорисовки истребителя
- ///
- private readonly int _drawningFighterHeight = 65;
-
- ///
- /// Инициализация свойств
- ///
- /// Скорость
- /// >Вес истребителя
- /// Основной цвет
- /// Дополнительный цвет
- /// Признак наличия ракет
- /// Признак наличия доп. крыльев
- public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool rockets, bool extraWings)
- {
- EntityFighter = new EntityFighter();
- EntityFighter.Init(speed, weight, bodyColor, additionalColor, rockets, extraWings);
- _pictureWidth = null;
- _pictureHeight = null;
- _startPosX = null;
- _startPosY = null;
- }
-
- ///
- /// Установка границ поля
- ///
- /// Ширина поля
- /// Высота поля
- /// true - границы заданы, false - проверка не пройдена, нельзя разместить объект в этих размерах
- public bool SetPictureSize(int width, int height)
- {
- if (width >= _drawningFighterWidth && height >= _drawningFighterHeight)
- {
- _pictureWidth = width;
- _pictureHeight = height;
- if (_startPosX.HasValue && _startPosY.HasValue)
- {
- SetPosition(_startPosX.Value, _startPosY.Value);
- }
- return true;
- }
-
-
- return false;
- }
-
- ///
- /// Установка позиции
- ///
- /// Координата X
- /// Координата Y
- public void SetPosition(int x, int y)
- {
- if (!_pictureHeight.HasValue || !_pictureWidth.HasValue)
- {
- return;
- }
- if (x < 0)
- {
- x = 0;
- }
- else if (x > _pictureWidth.Value - _drawningFighterWidth)
- {
- x = _pictureWidth.Value - _drawningFighterWidth;
- }
-
- if (y < 0)
- {
- y = 0;
- }
- else if (y > _pictureHeight.Value - _drawningFighterHeight)
- {
- y = _pictureHeight.Value - _drawningFighterHeight;
- }
-
- _startPosX = x;
- _startPosY = y;
- }
-
-
- ///
- /// Изменение направления перемещения
- ///
- /// Направление
- /// true - перемещене выполнено, false - перемещение невозможно
- public bool MoveTransport(DirectionType direction)
- {
- if (EntityFighter == null || !_startPosX.HasValue || !_startPosY.HasValue)
- {
- return false;
- }
- switch (direction)
- {
- //влево
- case DirectionType.Left:
- if (_startPosX.Value - EntityFighter.Step > 0)
- {
- _startPosX -= (int)EntityFighter.Step;
- }
- return true;
- //Вверх
- case DirectionType.Up:
- if (_startPosY.Value - EntityFighter.Step > 0)
- {
- _startPosY -= (int)EntityFighter.Step;
- }
- return true;
-
- //Вправо
- case DirectionType.Right:
- if (_startPosX.Value + EntityFighter.Step + _drawningFighterWidth < _pictureWidth)
- {
- _startPosX += (int)EntityFighter.Step;
- }
- return true;
- //Вниз
- case DirectionType.Down:
- if (_startPosY.Value + EntityFighter.Step + _drawningFighterHeight < _pictureHeight)
- {
- _startPosY += (int)EntityFighter.Step;
- }
- return true;
- default:
- return false;
- }
- }
-
- ///
- /// Прорисовка объекта
- ///
- ///
- public void DrawTransport(Graphics g)
- {
- if (EntityFighter == null || !_startPosX.HasValue || !_startPosY.HasValue)
- {
- return;
- }
- Pen pen = new(Color.Black);
- Brush additionalBrush = new SolidBrush(EntityFighter.AdditionalColor);
- Brush BodyBrush = new SolidBrush(EntityFighter.BodyColor);
- Brush CraneBrush = new SolidBrush(EntityFighter.AdditionalColor);
-
-
- //корпус
- g.FillRectangle(BodyBrush, _startPosX.Value + 10, _startPosY.Value + 30, 62, 12);
- g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 30, 62, 12);
- g.FillRectangle(BodyBrush, _startPosX.Value + 22, _startPosY.Value + 16, 4, 15);
- g.DrawRectangle(pen, _startPosX.Value + 22, _startPosY.Value + 16, 4, 14);
- g.FillRectangle(BodyBrush, _startPosX.Value + 37, _startPosY.Value + 1, 5, 30);
- g.DrawRectangle(pen, _startPosX.Value + 37, _startPosY.Value + 1, 5, 30);
-
- //стекло
- g.FillRectangle(additionalBrush, _startPosX.Value + 52, _startPosY.Value + 14, 21, 16);
- g.DrawRectangle(pen, _startPosX.Value + 52, _startPosY.Value + 14, 20, 16);
-
- //гусеницы
- g.DrawLine(pen, _startPosX.Value + 8, _startPosY.Value + 42, _startPosX.Value + 10, _startPosY.Value + 42);
- g.DrawLine(pen, _startPosX.Value + 7, _startPosY.Value + 43, _startPosX.Value + 7, _startPosY.Value + 53);
- g.DrawLine(pen, _startPosX.Value + 8, _startPosY.Value + 54, _startPosX.Value + 12, _startPosY.Value + 54);
- g.DrawLine(pen, _startPosX.Value + 13, _startPosY.Value + 55, _startPosX.Value + 69, _startPosY.Value + 55);
- g.DrawLine(pen, _startPosX.Value + 70, _startPosY.Value + 54, _startPosX.Value + 73, _startPosY.Value + 54);
- g.DrawLine(pen, _startPosX.Value + 74, _startPosY.Value + 53, _startPosX.Value + 74, _startPosY.Value + 43);
- g.DrawLine(pen, _startPosX.Value + 71, _startPosY.Value + 42, _startPosX.Value + 73, _startPosY.Value + 42);
-
- //колеса
- g.FillEllipse(BodyBrush, _startPosX.Value + 10, _startPosY.Value + 44, 9, 9);
- g.DrawEllipse(pen, _startPosX.Value + 10, _startPosY.Value + 44, 9, 9);
- g.FillEllipse(BodyBrush, _startPosX.Value + 63, _startPosY.Value + 44, 9, 9);
- g.DrawEllipse(pen, _startPosX.Value + 63, _startPosY.Value + 44, 9, 9);
-
- g.FillEllipse(BodyBrush, _startPosX.Value + 25, _startPosY.Value + 48, 6, 6);
- g.DrawEllipse(pen, _startPosX.Value + 25, _startPosY.Value + 48, 6, 6);
- g.FillEllipse(BodyBrush, _startPosX.Value + 38, _startPosY.Value + 48, 6, 6);
- g.DrawEllipse(pen, _startPosX.Value + 38, _startPosY.Value + 48, 6, 6);
- g.FillEllipse(BodyBrush, _startPosX.Value + 50, _startPosY.Value + 48, 6, 6);
- g.DrawEllipse(pen, _startPosX.Value + 50, _startPosY.Value + 48, 6, 6);
-
- g.FillEllipse(BodyBrush, _startPosX.Value + 33, _startPosY.Value + 44, 4, 4);
- g.DrawEllipse(pen, _startPosX.Value + 33, _startPosY.Value + 44, 4, 4);
- g.FillEllipse(BodyBrush, _startPosX.Value + 45, _startPosY.Value + 44, 4, 4);
- g.DrawEllipse(pen, _startPosX.Value + 45, _startPosY.Value + 44, 4, 4);
-
- if (EntityFighter.Kovsh)
- {
-
- //ковш
- g.DrawRectangle(pen, _startPosX.Value - 2, _startPosY.Value + 37, 8, 15);
- g.FillRectangle(CraneBrush, _startPosX.Value - 2, _startPosY.Value + 37, 8, 15);
- g.DrawRectangle(pen, _startPosX.Value - -6, _startPosY.Value + 37, 4, 1);
-
- }
-
- //противовес
- if (EntityFighter.Otval)
- {
- g.DrawRectangle(pen, _startPosX.Value + 73, _startPosY.Value + 37, 17, 1);
- g.DrawRectangle(pen, _startPosX.Value + 90, _startPosY.Value + 37, 1, 17);
-
-
- }
- }
-
-}
diff --git a/solution/lab1/DirectionType.cs b/solution/lab1/Drawnings/DirectionType.cs
similarity index 94%
rename from solution/lab1/DirectionType.cs
rename to solution/lab1/Drawnings/DirectionType.cs
index 89efc51..89abcbf 100644
--- a/solution/lab1/DirectionType.cs
+++ b/solution/lab1/Drawnings/DirectionType.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace lab1;
+namespace lab1.Drawnings;
public enum DirectionType
{
diff --git a/solution/lab1/Drawnings/DrawningEntityFighter.cs b/solution/lab1/Drawnings/DrawningEntityFighter.cs
new file mode 100644
index 0000000..76a650d
--- /dev/null
+++ b/solution/lab1/Drawnings/DrawningEntityFighter.cs
@@ -0,0 +1,104 @@
+using lab1.Entities;
+namespace lab1.Drawnings;
+
+///
+/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
+///
+public class DrawningEntityFighter : DrawningTrackedVehicle
+{
+ ///
+ /// Конструктор
+ ///
+ /// Скорость
+ /// >Вес истребителя
+ /// Основной цвет
+ /// Дополнительный цвет
+ /// Признак наличия ракет
+ /// Признак наличия доп. крыльев
+ public DrawningEntityFighter(int speed, double weight, Color bodyColor, Color additionalColor, bool rockets, bool extraWings) : base (91, 65)
+ {
+ EntityTrackedVehicle = new EntityFighter(speed, weight, bodyColor, additionalColor, rockets, extraWings);
+
+ }
+
+ public override void DrawTransport(Graphics g)
+ {
+ if (EntityTrackedVehicle == null || EntityTrackedVehicle is not EntityFighter fighter || !_startPosX.HasValue || !_startPosY.HasValue)
+ {
+ return;
+ }
+ Pen pen = new(Color.Black);
+ Brush additionalBrush = new SolidBrush(fighter.AdditionalColor);
+ Brush BodyBrush = new SolidBrush(fighter.BodyColor);
+ Brush CraneBrush = new SolidBrush(fighter.AdditionalColor);
+
+
+ //корпус
+ g.FillRectangle(BodyBrush, _startPosX.Value + 10, _startPosY.Value + 30, 62, 12);
+ g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 30, 62, 12);
+ g.FillRectangle(BodyBrush, _startPosX.Value + 22, _startPosY.Value + 16, 4, 15);
+ g.DrawRectangle(pen, _startPosX.Value + 22, _startPosY.Value + 16, 4, 14);
+ g.FillRectangle(BodyBrush, _startPosX.Value + 37, _startPosY.Value + 1, 5, 30);
+ g.DrawRectangle(pen, _startPosX.Value + 37, _startPosY.Value + 1, 5, 30);
+
+ //стекло
+ g.FillRectangle(additionalBrush, _startPosX.Value + 52, _startPosY.Value + 14, 21, 16);
+ g.DrawRectangle(pen, _startPosX.Value + 52, _startPosY.Value + 14, 20, 16);
+
+ //гусеницы
+ g.DrawLine(pen, _startPosX.Value + 8, _startPosY.Value + 42, _startPosX.Value + 10, _startPosY.Value + 42);
+ g.DrawLine(pen, _startPosX.Value + 7, _startPosY.Value + 43, _startPosX.Value + 7, _startPosY.Value + 53);
+ g.DrawLine(pen, _startPosX.Value + 8, _startPosY.Value + 54, _startPosX.Value + 12, _startPosY.Value + 54);
+ g.DrawLine(pen, _startPosX.Value + 13, _startPosY.Value + 55, _startPosX.Value + 69, _startPosY.Value + 55);
+ g.DrawLine(pen, _startPosX.Value + 70, _startPosY.Value + 54, _startPosX.Value + 73, _startPosY.Value + 54);
+ g.DrawLine(pen, _startPosX.Value + 74, _startPosY.Value + 53, _startPosX.Value + 74, _startPosY.Value + 43);
+ g.DrawLine(pen, _startPosX.Value + 71, _startPosY.Value + 42, _startPosX.Value + 73, _startPosY.Value + 42);
+
+ //колеса
+ g.FillEllipse(BodyBrush, _startPosX.Value + 10, _startPosY.Value + 44, 9, 9);
+ g.DrawEllipse(pen, _startPosX.Value + 10, _startPosY.Value + 44, 9, 9);
+ g.FillEllipse(BodyBrush, _startPosX.Value + 63, _startPosY.Value + 44, 9, 9);
+ g.DrawEllipse(pen, _startPosX.Value + 63, _startPosY.Value + 44, 9, 9);
+
+ g.FillEllipse(BodyBrush, _startPosX.Value + 25, _startPosY.Value + 48, 6, 6);
+ g.DrawEllipse(pen, _startPosX.Value + 25, _startPosY.Value + 48, 6, 6);
+ g.FillEllipse(BodyBrush, _startPosX.Value + 38, _startPosY.Value + 48, 6, 6);
+ g.DrawEllipse(pen, _startPosX.Value + 38, _startPosY.Value + 48, 6, 6);
+ g.FillEllipse(BodyBrush, _startPosX.Value + 50, _startPosY.Value + 48, 6, 6);
+ g.DrawEllipse(pen, _startPosX.Value + 50, _startPosY.Value + 48, 6, 6);
+
+ g.FillEllipse(BodyBrush, _startPosX.Value + 33, _startPosY.Value + 44, 4, 4);
+ g.DrawEllipse(pen, _startPosX.Value + 33, _startPosY.Value + 44, 4, 4);
+ g.FillEllipse(BodyBrush, _startPosX.Value + 45, _startPosY.Value + 44, 4, 4);
+ g.DrawEllipse(pen, _startPosX.Value + 45, _startPosY.Value + 44, 4, 4);
+
+
+
+ _startPosX += 10;
+ _startPosY += 25;
+ base.DrawTransport(g);
+ _startPosX -= 10;
+ _startPosY -= 25;
+
+ if (fighter.Kovsh)
+ {
+
+ //ковш
+ g.DrawRectangle(pen, _startPosX.Value - 2, _startPosY.Value + 37, 8, 15);
+ g.FillRectangle(CraneBrush, _startPosX.Value - 2, _startPosY.Value + 37, 8, 15);
+ g.DrawRectangle(pen, _startPosX.Value - -6, _startPosY.Value + 37, 4, 1);
+
+ }
+
+ //противовес
+ if (fighter.Otval)
+ {
+ g.DrawRectangle(pen, _startPosX.Value + 73, _startPosY.Value + 37, 17, 1);
+ g.DrawRectangle(pen, _startPosX.Value + 90, _startPosY.Value + 37, 1, 17);
+
+
+ }
+
+ }
+
+}
diff --git a/solution/lab1/Drawnings/DrawningTrackedVehicle.cs b/solution/lab1/Drawnings/DrawningTrackedVehicle.cs
new file mode 100644
index 0000000..6ae79f9
--- /dev/null
+++ b/solution/lab1/Drawnings/DrawningTrackedVehicle.cs
@@ -0,0 +1,244 @@
+using lab1.Entities;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace lab1.Drawnings;
+
+public class DrawningTrackedVehicle
+{ ///
+ /// Класс-сущность
+ ///
+ public EntityTrackedVehicle? EntityTrackedVehicle { get; protected set; }
+
+ ///
+ /// Ширина окна
+ ///
+ private int? _pictureWidth;
+
+ ///
+ /// Высота окна
+ ///
+ private int? _pictureHeight;
+
+ ///
+ /// Левая координата прорисовки истребителя
+ ///
+ protected int? _startPosX;
+
+ ///
+ /// Верхняя координата прорисовки истребителя
+ ///
+ protected int? _startPosY;
+
+ ///
+ /// Ширина прорисовки истребителя
+ ///
+ private readonly int _drawningFighterWidth = 63;
+
+ ///
+ /// Высота прорисовки истребителя
+ ///
+ private readonly int _drawningFighterHeight = 54;
+ ///
+ /// Пустой конструктор
+ ///
+ private DrawningTrackedVehicle()
+ {
+ _pictureWidth = null;
+ _pictureHeight = null;
+ _startPosX = null;
+ _startPosY = null;
+ }
+
+
+ ///
+ /// Конструктор
+ ///
+ /// Скорость
+ /// >Вес истребителя
+ /// Основной цвет
+
+ public DrawningTrackedVehicle(int speed, double weight, Color bodyColor) : this()
+ {
+ EntityTrackedVehicle = new EntityTrackedVehicle(speed, weight, bodyColor);
+
+ }
+ ///
+ /// Конструктор для наследников
+ ///
+ /// Ширина прорисовки истребителя
+ /// >Высота прорисовки истребителя
+
+
+ protected DrawningTrackedVehicle(int _drawningFighterWidth, int _drawningFighterHeight) : this()
+ {
+ _drawningFighterWidth = _drawningFighterWidth;
+ _drawningFighterHeight = _drawningFighterHeight;
+
+ }
+
+
+ ///
+ /// Установка границ поля
+ ///
+ /// Ширина поля
+ /// Высота поля
+ /// true - границы заданы, false - проверка не пройдена, нельзя разместить объект в этих размерах
+ public bool SetPictureSize(int width, int height)
+ {
+ if (width >= _drawningFighterWidth && height >= _drawningFighterHeight)
+ {
+ _pictureWidth = width;
+ _pictureHeight = height;
+ if (_startPosX.HasValue && _startPosY.HasValue)
+ {
+ SetPosition(_startPosX.Value, _startPosY.Value);
+ }
+ return true;
+ }
+
+
+ return false;
+ }
+
+ ///
+ /// Установка позиции
+ ///
+ /// Координата X
+ /// Координата Y
+ public void SetPosition(int x, int y)
+ {
+ if (!_pictureHeight.HasValue || !_pictureWidth.HasValue)
+ {
+ return;
+ }
+ if (x < 0)
+ {
+ x = 0;
+ }
+ else if (x > _pictureWidth.Value - _drawningFighterWidth)
+ {
+ x = _pictureWidth.Value - _drawningFighterWidth;
+ }
+
+ if (y < 0)
+ {
+ y = 0;
+ }
+ else if (y > _pictureHeight.Value - _drawningFighterHeight)
+ {
+ y = _pictureHeight.Value - _drawningFighterHeight;
+ }
+
+ _startPosX = x;
+ _startPosY = y;
+ }
+
+
+ ///
+ /// Изменение направления перемещения
+ ///
+ /// Направление
+ /// true - перемещене выполнено, false - перемещение невозможно
+ public bool MoveTransport(DirectionType direction)
+ {
+ if (EntityTrackedVehicle == null || !_startPosX.HasValue || !_startPosY.HasValue)
+ {
+ return false;
+ }
+ switch (direction)
+ {
+ //влево
+ case DirectionType.Left:
+ if (_startPosX.Value - EntityTrackedVehicle.Step > 0)
+ {
+ _startPosX -= (int)EntityTrackedVehicle.Step;
+ }
+ return true;
+ //Вверх
+ case DirectionType.Up:
+ if (_startPosY.Value - EntityTrackedVehicle.Step > 0)
+ {
+ _startPosY -= (int)EntityTrackedVehicle.Step;
+ }
+ return true;
+
+ //Вправо
+ case DirectionType.Right:
+ if (_startPosX.Value + EntityTrackedVehicle.Step + _drawningFighterWidth < _pictureWidth)
+ {
+ _startPosX += (int)EntityTrackedVehicle.Step;
+ }
+ return true;
+ //Вниз
+ case DirectionType.Down:
+ if (_startPosY.Value + EntityTrackedVehicle.Step + _drawningFighterHeight < _pictureHeight)
+ {
+ _startPosY += (int)EntityTrackedVehicle.Step;
+ }
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ ///
+ /// Прорисовка объекта
+ ///
+ ///
+ public virtual void DrawTransport(Graphics g)
+ {
+ if (EntityTrackedVehicle == null || !_startPosX.HasValue || !_startPosY.HasValue)
+ {
+ return;
+ }
+ Pen pen = new(Color.Black);
+
+ Brush BodyBrush = new SolidBrush(EntityTrackedVehicle.BodyColor);
+
+ //корпус
+ g.FillRectangle(BodyBrush, _startPosX.Value, _startPosY.Value + 5, 62, 12);
+ g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 5, 62, 12);
+ g.FillRectangle(BodyBrush, _startPosX.Value + 12, _startPosY.Value - 9, 4, 15);
+ g.DrawRectangle(pen, _startPosX.Value +12, _startPosY.Value - 9, 4, 14);
+ g.FillRectangle(BodyBrush, _startPosX.Value + 27, _startPosY.Value - 24, 5, 30);
+ g.DrawRectangle(pen, _startPosX.Value + 27, _startPosY.Value - 24, 5, 30);
+
+ //стекло
+ g.FillRectangle(BodyBrush, _startPosX.Value + 42, _startPosY.Value - 11, 21, 16);
+ g.DrawRectangle(pen, _startPosX.Value + 42, _startPosY.Value -11, 20, 16);
+
+ //гусеницы
+ g.DrawLine(pen, _startPosX.Value - 2, _startPosY.Value + 17, _startPosX.Value, _startPosY.Value + 17);
+ g.DrawLine(pen, _startPosX.Value - 3, _startPosY.Value + 18, _startPosX.Value - 3, _startPosY.Value + 28);
+ g.DrawLine(pen, _startPosX.Value - 2, _startPosY.Value + 29, _startPosX.Value + 2, _startPosY.Value + 29);
+ g.DrawLine(pen, _startPosX.Value + 3, _startPosY.Value + 30, _startPosX.Value + 59, _startPosY.Value + 30);
+ g.DrawLine(pen, _startPosX.Value + 60, _startPosY.Value + 29, _startPosX.Value + 63, _startPosY.Value + 29);
+ g.DrawLine(pen, _startPosX.Value + 64, _startPosY.Value + 28, _startPosX.Value + 64, _startPosY.Value + 18);
+ g.DrawLine(pen, _startPosX.Value + 61, _startPosY.Value + 17, _startPosX.Value + 63, _startPosY.Value + 17);
+
+ //колеса
+ g.FillEllipse(BodyBrush, _startPosX.Value, _startPosY.Value + 19, 9, 9);
+ g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 19, 9, 9);
+ g.FillEllipse(BodyBrush, _startPosX.Value + 53, _startPosY.Value + 19, 9, 9);
+ g.DrawEllipse(pen, _startPosX.Value + 53, _startPosY.Value + 19, 9, 9);
+
+ g.FillEllipse(BodyBrush, _startPosX.Value + 15, _startPosY.Value + 23, 6, 6);
+ g.DrawEllipse(pen, _startPosX.Value + 15, _startPosY.Value + 23, 6, 6);
+ g.FillEllipse(BodyBrush, _startPosX.Value + 28, _startPosY.Value + 23, 6, 6);
+ g.DrawEllipse(pen, _startPosX.Value + 28, _startPosY.Value + 23, 6, 6);
+ g.FillEllipse(BodyBrush, _startPosX.Value + 40, _startPosY.Value + 23, 6, 6);
+ g.DrawEllipse(pen, _startPosX.Value + 40, _startPosY.Value + 23, 6, 6);
+
+ g.FillEllipse(BodyBrush, _startPosX.Value + 23, _startPosY.Value + 19, 4, 4);
+ g.DrawEllipse(pen, _startPosX.Value + 23, _startPosY.Value + 19, 4, 4);
+ g.FillEllipse(BodyBrush, _startPosX.Value + 35, _startPosY.Value + 19, 4, 4);
+ g.DrawEllipse(pen, _startPosX.Value + 35, _startPosY.Value + 19, 4, 4);
+
+
+ }
+
+}
diff --git a/solution/lab1/EntityFighter.cs b/solution/lab1/Entities/EntityFighter.cs
similarity index 64%
rename from solution/lab1/EntityFighter.cs
rename to solution/lab1/Entities/EntityFighter.cs
index ecd7383..aa5b776 100644
--- a/solution/lab1/EntityFighter.cs
+++ b/solution/lab1/Entities/EntityFighter.cs
@@ -1,23 +1,12 @@
-namespace lab1;
+namespace lab1.Entities;
///
/// Класс-сущность "Истребитель"
///
-public class EntityFighter
+public class EntityFighter : EntityTrackedVehicle
{
- ///
- /// Скорость
- ///
- public int Speed { get; set; }
- ///
- /// Вес
- ///
- public double Weight { get; set; }
- ///
- /// Основной цвет
- ///
- public Color BodyColor { get; private set; }
+
///
/// Дополнительный цвет (для опциональных элементов)
///
@@ -30,10 +19,7 @@ public class EntityFighter
/// Признак (опция) наличия доп. крыльев
///
public bool Otval { get; private set; }
- ///
- /// Шаг перемещения истребителя
- ///
- public double Step => Speed * 100 / Weight;
+
///
/// Инициализация полей объекта-класса истребителя
///
@@ -44,11 +30,9 @@ public class EntityFighter
/// Признак наличия ракет
/// Признак наличия доп. крыльев
- public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool rockets, bool extraWings)
+ public EntityFighter(int speed, double weight, Color bodyColor, Color additionalColor, bool rockets, bool extraWings) : base(speed, weight, bodyColor)
{
- Speed = speed;
- Weight = weight;
- BodyColor = bodyColor;
+
AdditionalColor = additionalColor;
Kovsh = rockets;
Otval = extraWings;
diff --git a/solution/lab1/Entities/EntityTrackedVehicle.cs b/solution/lab1/Entities/EntityTrackedVehicle.cs
new file mode 100644
index 0000000..79c5c87
--- /dev/null
+++ b/solution/lab1/Entities/EntityTrackedVehicle.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace lab1.Entities;
+///
+/// Класс-сущность "Гусеничная машина"
+///
+public class EntityTrackedVehicle
+{
+ ///
+ /// Скорость
+ ///
+ public int Speed { get; set; }
+ ///
+ /// Вес
+ ///
+ public double Weight { get; set; }
+ ///
+ /// Основной цвет
+ ///
+ public Color BodyColor { get; private set; }
+
+ ///
+ /// Шаг перемещения истребителя
+ ///
+ public double Step => Speed * 100 / Weight;
+
+ ///
+ /// Конструктор сущности
+ ///
+ /// Скорость
+ /// >Вес истребителя
+ /// Основной цвет
+ public EntityTrackedVehicle(int speed, double weight, Color bodyColor)
+ {
+ Speed = speed;
+ Weight = weight;
+ BodyColor = bodyColor;
+
+
+ }
+}
diff --git a/solution/lab1/FormFighter.Designer.cs b/solution/lab1/FormFighter.Designer.cs
index 3a27286..4888291 100644
--- a/solution/lab1/FormFighter.Designer.cs
+++ b/solution/lab1/FormFighter.Designer.cs
@@ -34,6 +34,7 @@
buttonDown = new Button();
buttonUp = new Button();
buttonRight = new Button();
+ buttonCreateTrackedVehicle = new Button();
((System.ComponentModel.ISupportInitialize)pictureBoxFighter).BeginInit();
SuspendLayout();
//
@@ -51,11 +52,11 @@
buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonCreate.Location = new Point(12, 538);
buttonCreate.Name = "buttonCreate";
- buttonCreate.Size = new Size(112, 34);
+ buttonCreate.Size = new Size(226, 34);
buttonCreate.TabIndex = 1;
- buttonCreate.Text = "создать";
+ buttonCreate.Text = "создать истребитель";
buttonCreate.UseVisualStyleBackColor = true;
- buttonCreate.Click += buttonCreate_Click_1;
+ buttonCreate.Click += ButtonCreate_Click;
//
// buttonLeft
//
@@ -68,7 +69,7 @@
buttonLeft.Size = new Size(52, 52);
buttonLeft.TabIndex = 2;
buttonLeft.UseVisualStyleBackColor = false;
- buttonLeft.Click += buttonMove_Click;
+ buttonLeft.Click += ButtonMove_Click;
//
// buttonDown
//
@@ -81,7 +82,7 @@
buttonDown.Size = new Size(52, 52);
buttonDown.TabIndex = 3;
buttonDown.UseVisualStyleBackColor = false;
- buttonDown.Click += buttonMove_Click;
+ buttonDown.Click += ButtonMove_Click;
//
// buttonUp
//
@@ -94,7 +95,7 @@
buttonUp.Size = new Size(52, 52);
buttonUp.TabIndex = 4;
buttonUp.UseVisualStyleBackColor = false;
- buttonUp.Click += buttonMove_Click;
+ buttonUp.Click += ButtonMove_Click;
//
// buttonRight
//
@@ -107,13 +108,25 @@
buttonRight.Size = new Size(52, 52);
buttonRight.TabIndex = 5;
buttonRight.UseVisualStyleBackColor = false;
- buttonRight.Click += buttonMove_Click;
+ buttonRight.Click += ButtonMove_Click;
+ //
+ // buttonCreateTrackedVehicle
+ //
+ buttonCreateTrackedVehicle.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
+ buttonCreateTrackedVehicle.Location = new Point(234, 538);
+ buttonCreateTrackedVehicle.Name = "buttonCreateTrackedVehicle";
+ buttonCreateTrackedVehicle.Size = new Size(264, 34);
+ buttonCreateTrackedVehicle.TabIndex = 6;
+ buttonCreateTrackedVehicle.Text = "создать гусеничную машину";
+ buttonCreateTrackedVehicle.UseVisualStyleBackColor = true;
+ buttonCreateTrackedVehicle.Click += ButtonCreateTrackedVehicle_Click;
//
// FormFighter
//
AutoScaleDimensions = new SizeF(10F, 25F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1015, 584);
+ Controls.Add(buttonCreateTrackedVehicle);
Controls.Add(buttonRight);
Controls.Add(buttonUp);
Controls.Add(buttonDown);
@@ -135,5 +148,6 @@
private Button buttonDown;
private Button buttonUp;
private Button buttonRight;
+ private Button buttonCreateTrackedVehicle;
}
}
\ No newline at end of file
diff --git a/solution/lab1/FormFighter.cs b/solution/lab1/FormFighter.cs
index 591cf7d..5b52c83 100644
--- a/solution/lab1/FormFighter.cs
+++ b/solution/lab1/FormFighter.cs
@@ -1,4 +1,5 @@
using lab1;
+using lab1.Drawnings;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -9,82 +10,122 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
-namespace lab1
+namespace lab1;
+
+
+
+public partial class FormFighter : Form
{
-
-
- public partial class FormFighter : Form
+ private DrawningTrackedVehicle? _drawningTrackedVehicle;
+ public FormFighter()
{
- private DrawningEntityFighter? _drawningFighter;
- public FormFighter()
+ InitializeComponent();
+ }
+
+ private void Draw()
+ {
+ if (_drawningTrackedVehicle == null)
{
- InitializeComponent();
+ return;
}
- private void Draw()
+ Bitmap bmp = new(pictureBoxFighter.Width, pictureBoxFighter.Height);
+ Graphics gr = Graphics.FromImage(bmp);
+ _drawningTrackedVehicle.DrawTransport(gr);
+ pictureBoxFighter.Image = bmp;
+ }
+
+ ///
+ /// Создание объекта класса-перемещения
+ ///
+ ///
+ private void CreateObject(string type)
+ {
+ Random random = new();
+ switch (type)
{
- if (_drawningFighter == null)
- {
+ case nameof(DrawningTrackedVehicle):
+ _drawningTrackedVehicle = new DrawningTrackedVehicle(random.Next(100, 300), random.Next(1000, 3000),
+ Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)));
+ break;
+ case nameof(DrawningEntityFighter):
+ _drawningTrackedVehicle = new DrawningEntityFighter(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)));
+ break;
+ default:
return;
- }
- Bitmap bmp = new(pictureBoxFighter.Width, pictureBoxFighter.Height);
- Graphics gr = Graphics.FromImage(bmp);
- _drawningFighter.DrawTransport(gr);
- pictureBoxFighter.Image = bmp;
+ }
+ _drawningTrackedVehicle.SetPictureSize(pictureBoxFighter.Width, pictureBoxFighter.Height);
+ _drawningTrackedVehicle.SetPosition(random.Next(10, 100), random.Next(10, 100));
+ Draw();
+ }
+
+
+
+ ///
+ /// Обработка нажатия кнопки "Создать истребитель"
+ ///
+ ///
+ ///
+ private void ButtonCreate_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningEntityFighter));
+
+
+ ///
+ /// Обработка нажатия кнопки "Создать гусеничную машину"
+ ///
+ ///
+ ///
+ private void ButtonCreateTrackedVehicle_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningTrackedVehicle));
+
+
+
+
+
+
+
+
+
+
+ private void ButtonMove_Click(object sender, EventArgs e)
+ {
+ if (_drawningTrackedVehicle == null)
+ {
+ return;
}
-
-
- private void buttonMove_Click(object sender, EventArgs e)
+ string name = ((Button)sender)?.Name ?? string.Empty;
+ bool result = false;
+ switch (name)
{
- if (_drawningFighter == null)
- {
- return;
- }
-
- string name = ((Button)sender)?.Name ?? string.Empty;
- bool result = false;
- switch (name)
- {
- case "buttonUp":
- result = _drawningFighter.MoveTransport(DirectionType.Up);
- break;
- case "buttonDown":
- result = _drawningFighter.MoveTransport(DirectionType.Down);
- break;
- case "buttonLeft":
- result = _drawningFighter.MoveTransport(DirectionType.Left);
- break;
- case "buttonRight":
- result = _drawningFighter.MoveTransport(DirectionType.Right);
- break;
- }
-
- if (result)
- {
- Draw();
- }
+ case "buttonUp":
+ result = _drawningTrackedVehicle.MoveTransport(DirectionType.Up);
+ break;
+ case "buttonDown":
+ result = _drawningTrackedVehicle.MoveTransport(DirectionType.Down);
+ break;
+ case "buttonLeft":
+ result = _drawningTrackedVehicle.MoveTransport(DirectionType.Left);
+ break;
+ case "buttonRight":
+ result = _drawningTrackedVehicle.MoveTransport(DirectionType.Right);
+ break;
}
- private void buttonCreate_Click_1(object sender, EventArgs e)
+ if (result)
{
- {
- Random random = new();
- _drawningFighter = new DrawningEntityFighter();
- _drawningFighter.Init(random.Next(100, 300), random.Next(1200, 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)));
- _drawningFighter.SetPictureSize(pictureBoxFighter.Width, pictureBoxFighter.Height);
- _drawningFighter.SetPosition(random.Next(10, 100), random.Next(10, 100));
- Draw();
- }
- }
-
- private void FormFighter_Load(object sender, EventArgs e)
- {
-
+ Draw();
}
}
+
+
+
+ private void FormFighter_Load(object sender, EventArgs e)
+ {
+
+ }
+
+
}