From 26ce39f91a7efb20ab88b3134fa23e8a7d048fae Mon Sep 17 00:00:00 2001 From: Aleksandr4350 Date: Tue, 2 Apr 2024 19:20:22 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectSportCar/DrawningAiroplane.cs | 250 ---------------- .../{ => Drawnings}/DirectionType.cs | 7 +- .../Drawnings/DrawningAiroplane.cs | 58 ++++ .../Drawnings/Drawningplane.cs | 269 ++++++++++++++++++ .../{ => Entities}/EntityAiroplane.cs | 30 +- .../ProjectSportCar/Entities/Entityplane.cs | 48 ++++ .../ProjectSportCar/FormAiroplane.Designer.cs | 70 ++++- .../ProjectSportCar/FormAiroplane.cs | 197 +++++++++---- .../MovementStrategy/AbstractStrategy.cs | 121 ++++++++ .../MovementStrategy/IMoveableObjects.cs | 16 ++ .../MovementStrategy/MoveToBorder.cs | 36 +++ .../MovementStrategy/MoveToCenter.cs | 54 ++++ .../MovementStrategy/Moveableplane.cs | 49 ++++ .../MovementStrategy/MovementDirection.cs | 26 ++ .../MovementStrategy/ObjectParameters.cs | 60 ++++ .../MovementStrategy/StrategyStatus.cs | 20 ++ 16 files changed, 958 insertions(+), 353 deletions(-) delete mode 100644 ProjectSportCar/ProjectSportCar/DrawningAiroplane.cs rename ProjectSportCar/ProjectSportCar/{ => Drawnings}/DirectionType.cs (72%) create mode 100644 ProjectSportCar/ProjectSportCar/Drawnings/DrawningAiroplane.cs create mode 100644 ProjectSportCar/ProjectSportCar/Drawnings/Drawningplane.cs rename ProjectSportCar/ProjectSportCar/{ => Entities}/EntityAiroplane.cs (58%) create mode 100644 ProjectSportCar/ProjectSportCar/Entities/Entityplane.cs create mode 100644 ProjectSportCar/ProjectSportCar/MovementStrategy/AbstractStrategy.cs create mode 100644 ProjectSportCar/ProjectSportCar/MovementStrategy/IMoveableObjects.cs create mode 100644 ProjectSportCar/ProjectSportCar/MovementStrategy/MoveToBorder.cs create mode 100644 ProjectSportCar/ProjectSportCar/MovementStrategy/MoveToCenter.cs create mode 100644 ProjectSportCar/ProjectSportCar/MovementStrategy/Moveableplane.cs create mode 100644 ProjectSportCar/ProjectSportCar/MovementStrategy/MovementDirection.cs create mode 100644 ProjectSportCar/ProjectSportCar/MovementStrategy/ObjectParameters.cs create mode 100644 ProjectSportCar/ProjectSportCar/MovementStrategy/StrategyStatus.cs diff --git a/ProjectSportCar/ProjectSportCar/DrawningAiroplane.cs b/ProjectSportCar/ProjectSportCar/DrawningAiroplane.cs deleted file mode 100644 index 1e63da0..0000000 --- a/ProjectSportCar/ProjectSportCar/DrawningAiroplane.cs +++ /dev/null @@ -1,250 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProjectAiroplane; -/// -/// Класс отвечающий за прорисовку и перемещение объекта-сущности -/// -public class DrawningAiroplane -{ - /// - /// Класс-сущность - /// - public EntityAiroplane? EntityAiroplane { get; private set; } - /// - /// Ширина окна - /// - private int? _pictureWidth; - /// - /// Высота окна - /// - private int? _pictureHeight; - /// - /// Левая координата прорисовки - /// - private int? _startPosX; - /// - /// Верхняя кооридната прорисовки - /// - private int? _startPosY; - /// - /// Ширина прорисовки - /// - private readonly int _drawningAiroplaneWidth = 160; - /// - /// Высота прорисовки - /// - private readonly int _drawningaAiroplaneHeight = 80; - - /// - /// Инициализация свойств - /// - /// Скорость - /// Вес - /// Основной цвет - /// Дополнительный цвет - /// Признак наличия бака - /// Признак наличия радара - - public void Init(int speed, double weight, Color bodyColor, Color - additionalColor, bool toplivbak, bool radar) - { - EntityAiroplane = new EntityAiroplane(); - EntityAiroplane.Init(speed, weight, bodyColor, additionalColor, toplivbak, radar); - _pictureWidth = null; - _pictureHeight = null; - _startPosX = null; - _startPosY = null; - } - - /// - /// Установка границ поля - /// - /// Ширина поля - /// Высота поля - /// true - границы заданы, false - проверка не пройдена, нельзя разместить объект в этих размерах -public bool SetPictureSize(int width, int height) - { - // TODO проверка, что объект "влезает" в размеры поля - // если влезает, сохраняем границы и корректируем позицию объекта,если она была уже установлена - - if (width >= _drawningAiroplaneWidth && height >= _drawningaAiroplaneHeight) - { - _pictureWidth = width; - _pictureHeight = height; - - if (_startPosX.HasValue && _startPosY.HasValue) - { - if (_startPosX + _drawningAiroplaneWidth > _pictureWidth) - { - _startPosX = _pictureWidth - _drawningAiroplaneWidth; - } - - if (_startPosY + _drawningaAiroplaneHeight > _pictureWidth) - { - _startPosY = _pictureHeight - _drawningaAiroplaneHeight; - } - - } - return true; - } - return false; - } - /// - /// Установка позиции - /// - /// Координата X - /// Координата Y - public void SetPosition(int x, int y) - { - if (!_pictureHeight.HasValue || !_pictureWidth.HasValue) - { - return; - } - // TODO если при установке объекта в эти координаты, он будет"выходить" за границы формы - // то надо изменить координаты, чтобы он оставался в этих границах - - if (x < 0) - { - x = 0; - } - - else if (x + _drawningAiroplaneWidth > _pictureWidth.Value) - { - x = _pictureWidth.Value - _drawningAiroplaneWidth; - } - - if (y < 0) - { - y = 0; - } - - else if (y + _drawningaAiroplaneHeight > _pictureHeight.Value) - { - y = _pictureHeight.Value - _drawningaAiroplaneHeight; - } - - _startPosX = x; - _startPosY = y; - } - - /// - /// Изменение направления перемещения - /// - /// Направление - /// true - перемещене выполнено, false - перемещение невозможно -public bool MoveTransport(DirectionType direction) - { - if (EntityAiroplane == null || !_startPosX.HasValue || - !_startPosY.HasValue) - { - return false; - } - switch (direction) - { - //влево - case DirectionType.Left: - if (_startPosX.Value - EntityAiroplane.Step > 0) - { - _startPosX -= (int)EntityAiroplane.Step; - } - return true; - //вверх - case DirectionType.Up: - if (_startPosY.Value - EntityAiroplane.Step > 0) - { - _startPosY -= (int)EntityAiroplane.Step; - } - return true; - // вправо - case DirectionType.Right: - if (_startPosX.Value + _drawningAiroplaneWidth + EntityAiroplane.Step < _pictureWidth) - { - _startPosX += (int)EntityAiroplane.Step; - } - return true; - //вниз - case DirectionType.Down: - if (_startPosY.Value + _drawningaAiroplaneHeight + EntityAiroplane.Step < _pictureHeight) - { - _startPosY += (int)EntityAiroplane.Step; - } - return true; - default: - return false; - } - } - /// - /// Прорисовка объекта - /// - /// - public void DrawTransport(Graphics g) - { - if (EntityAiroplane == null || !_startPosX.HasValue || !_startPosY.HasValue) - { - return; - } - - Pen pen = new(Color.Black); - Brush additionalBrush = new - SolidBrush(EntityAiroplane.AdditionalColor); - - - - ////// - //крыло верхнее самолета - g.DrawLine(pen, _startPosX.Value + 15, _startPosY.Value + 5, _startPosX.Value + 15, _startPosY.Value + 5); - g.DrawLine(pen, _startPosX.Value + 15, _startPosY.Value + 5, _startPosX.Value + 55, _startPosY.Value + 35); - g.DrawLine(pen, _startPosX.Value + 15, _startPosY.Value + 35, _startPosX.Value + 15, _startPosY.Value + 5); - - //задняя часть самолета полукруг - g.DrawArc(pen, _startPosX.Value + 5, _startPosY.Value + 35, 30,30,90,180); - - //сзади - g.DrawEllipse(pen, _startPosX.Value + 10, _startPosY.Value + 30, 40,10); - Brush brbr = new SolidBrush(Color.Brown); - g.FillEllipse(brbr, _startPosX.Value + 10, _startPosY.Value + 30, 40,10); - //низ самолета - g.DrawLine(pen, _startPosX.Value + 16, _startPosY.Value + 65, _startPosX.Value + 135, _startPosY.Value + 65); - - // треуголник спереди - g.DrawLine(pen, _startPosX.Value + 135, _startPosY.Value + 68, _startPosX.Value + 135, _startPosY.Value + 32); - g.DrawLine(pen, _startPosX.Value + 135, _startPosY.Value + 32, _startPosX.Value + 160, _startPosY.Value + 50); - g.DrawLine(pen, _startPosX.Value + 135, _startPosY.Value + 68, _startPosX.Value + 160, _startPosY.Value + 50); - g.DrawLine(pen, _startPosX.Value + 135, _startPosY.Value + 50, _startPosX.Value + 160, _startPosY.Value + 50); - - //вверх от тругольника до треугольника - g.DrawLine(pen, _startPosX.Value + 50, _startPosY.Value + 35, _startPosX.Value + 135, _startPosY.Value + 35); - - //крыло - g.DrawEllipse(pen, _startPosX.Value + 50, _startPosY.Value + 45, 70, 10); - Brush brbl = new SolidBrush(Color.Black); - g.FillEllipse(brbl, _startPosX.Value + 50, _startPosY.Value + 45, 70, 10); - - //шасси - g.DrawLine(pen, _startPosX.Value + 35, _startPosY.Value + 65, _startPosX.Value + 35, _startPosY.Value + 75); - g.DrawLine(pen, _startPosX.Value + 120, _startPosY.Value + 65, _startPosX.Value + 120, _startPosY.Value + 75); - g.DrawLine(pen, _startPosX.Value + 25, _startPosY.Value + 75, _startPosX.Value + 45, _startPosY.Value + 75); - g.DrawEllipse(pen, _startPosX.Value + 15, _startPosY.Value + 70, 10, 10); - g.DrawEllipse(pen, _startPosX.Value + 45, _startPosY.Value + 70, 10, 10); - g.DrawEllipse(pen, _startPosX.Value + 115, _startPosY.Value + 70, 10, 10); - - //топливный бак - if (EntityAiroplane.Toplivbak) - { - g.FillRectangle(additionalBrush, _startPosX.Value + 65,_startPosY.Value + 20, 30, 15); - } - - //Радар - if (EntityAiroplane.Radar) - { - Brush brGreen = new SolidBrush(Color.LightGreen); - g.FillEllipse(brGreen, _startPosX.Value + 135, _startPosY.Value + 50, 10, 10); - g.DrawEllipse(pen, _startPosX.Value + 135, _startPosY.Value + 50, 10, 10); - } - } -} - diff --git a/ProjectSportCar/ProjectSportCar/DirectionType.cs b/ProjectSportCar/ProjectSportCar/Drawnings/DirectionType.cs similarity index 72% rename from ProjectSportCar/ProjectSportCar/DirectionType.cs rename to ProjectSportCar/ProjectSportCar/Drawnings/DirectionType.cs index e6c5d7d..bd35609 100644 --- a/ProjectSportCar/ProjectSportCar/DirectionType.cs +++ b/ProjectSportCar/ProjectSportCar/Drawnings/DirectionType.cs @@ -1,9 +1,12 @@ -namespace ProjectAiroplane; +namespace ProjectAiroplane.Drawnings; /// /// Направление перемещения /// public enum DirectionType -{ +{ /// + /// Неизвестное направление + /// + Unknow = -1, /// /// Вверх /// diff --git a/ProjectSportCar/ProjectSportCar/Drawnings/DrawningAiroplane.cs b/ProjectSportCar/ProjectSportCar/Drawnings/DrawningAiroplane.cs new file mode 100644 index 0000000..49c9015 --- /dev/null +++ b/ProjectSportCar/ProjectSportCar/Drawnings/DrawningAiroplane.cs @@ -0,0 +1,58 @@ +using ProjectAiroplane.Entities; + +namespace ProjectAiroplane.Drawnings; +/// +/// Класс отвечающий за прорисовку и перемещение объекта-сущности +/// +public class DrawningAiroplane : Drawningplane +{ + /// + /// Конструктор + /// + /// Скорость + /// Вес + /// Основной цвет + /// Дополнительный цвет + /// Признак наличия бака + /// Признак наличия радара + + public DrawningAiroplane(int speed, double weight, Color bodyColor, Color additionalColor, bool toplivbak, bool radar) : base(170,85) + { + Entityplane = new EntityAiroplane(speed, weight, bodyColor, additionalColor, toplivbak, radar); + } + + public override void DrawTransport(Graphics g) + { + if (Entityplane == null || Entityplane is not EntityAiroplane airoplane|| !_startPosX.HasValue || !_startPosY.HasValue) + { + return; + } + + Pen pen = new(Color.Black); + + Brush additionalBrush = new SolidBrush(airoplane.AdditionalColor); + if (airoplane.Toplivbak) + { + g.FillRectangle(additionalBrush, _startPosX.Value + 65,_startPosY.Value + 20, 30, 15); + } + + //Радар + if (airoplane.Radar) + { + Brush brGreen = new SolidBrush(Color.LightGreen); + g.FillEllipse(brGreen, _startPosX.Value + 135, _startPosY.Value + 45, 10, 10); + g.DrawEllipse(pen, _startPosX.Value + 135, _startPosY.Value + 45, 10, 10); + } + + _startPosX += 10; + _startPosY += 5; + + base.DrawTransport(g); + + _startPosX -= 10; + _startPosY -= 5; + } + + +} + diff --git a/ProjectSportCar/ProjectSportCar/Drawnings/Drawningplane.cs b/ProjectSportCar/ProjectSportCar/Drawnings/Drawningplane.cs new file mode 100644 index 0000000..8bc2fd2 --- /dev/null +++ b/ProjectSportCar/ProjectSportCar/Drawnings/Drawningplane.cs @@ -0,0 +1,269 @@ +using ProjectAiroplane.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAiroplane.Drawnings; + +public class Drawningplane +{ + /// + /// Класс-сущность + /// + public Entityplane? Entityplane { get; protected set; } + /// + /// Ширина окна + /// + private int? _pictureWidth; + /// + /// Высота окна + /// + private int? _pictureHeight; + /// + /// Левая координата прорисовки + /// + protected int? _startPosX; + /// + /// Верхняя кооридната прорисовки + /// + protected int? _startPosY; + /// + /// Ширина прорисовки + /// + private readonly int _drawningplaneWidth = 168; + /// + /// Высота прорисовки + /// + private readonly int _drawningplaneHeight = 80; + + // + /// Координата X объекта + /// + public int? GetPosX => _startPosX; + + /// + /// Координата Y объекта + /// + public int? GetPosY => _startPosY; + + /// + /// Ширина объекта + /// + public int GetWidth => _drawningplaneWidth; + + /// + /// Высота объекта + /// + public int GetHeight => _drawningplaneHeight; + + /// + /// Пустой конструктор + /// + private Drawningplane() + { + _pictureWidth = null; + _pictureHeight = null; + _startPosX = null; + _startPosY = null; + } + /// + /// Конструктор + /// + /// Скорость + /// Вес + /// Основной цвет + + public Drawningplane(int speed, double weight, Color bodyColor) : this() + { + Entityplane = new Entityplane(speed, weight, bodyColor); + } + + /// + /// Конструктор для наследников + /// + /// Ширина прорисовки + /// Высота прорисовки + + protected Drawningplane(int _drawningplaneWidth, int _drawningplaneHeight) : this() + { + _pictureWidth = _drawningplaneWidth;/// tut posmotret + _pictureHeight = _drawningplaneHeight; + + _pictureWidth = null; + _pictureHeight = null; + _startPosX = null; + _startPosY = null; + } + + /// + /// Установка границ поля + /// + /// Ширина поля + /// Высота поля + /// true - границы заданы, false - проверка не пройдена, нельзя разместить объект в этих размерах + public bool SetPictureSize(int width, int height) + { + // TODO проверка, что объект "влезает" в размеры поля + // если влезает, сохраняем границы и корректируем позицию объекта,если она была уже установлена + + if (width >= _drawningplaneWidth && height >= _drawningplaneHeight) + { + _pictureWidth = width; + _pictureHeight = height; + + if (_startPosX.HasValue && _startPosY.HasValue) + { + if (_startPosX + _drawningplaneWidth > _pictureWidth) + { + _startPosX = _pictureWidth - _drawningplaneWidth; + } + + if (_startPosY + _drawningplaneHeight > _pictureWidth) + { + _startPosY = _pictureHeight - _drawningplaneHeight; + } + + } + return true; + } + return false; + } + /// + /// Установка позиции + /// + /// Координата X + /// Координата Y + public void SetPosition(int x, int y) + { + if (!_pictureHeight.HasValue || !_pictureWidth.HasValue) + { + return; + } + // TODO если при установке объекта в эти координаты, он будет"выходить" за границы формы + // то надо изменить координаты, чтобы он оставался в этих границах + + if (x < 0) + { + x = 0; + } + + else if (x + _drawningplaneWidth > _pictureWidth.Value) + { + x = _pictureWidth.Value - _drawningplaneWidth; + } + + if (y < 0) + { + y = 0; + } + + else if (y + _drawningplaneHeight > _pictureHeight.Value) + { + y = _pictureHeight.Value - _drawningplaneHeight; + } + + _startPosX = x; + _startPosY = y; + } + + /// + /// Изменение направления перемещения + /// + /// Направление + /// true - перемещене выполнено, false - перемещение невозможно + public bool MoveTransport(DirectionType direction) + { + if (Entityplane == null || !_startPosX.HasValue || + !_startPosY.HasValue) + { + return false; + } + switch (direction) + { + //влево + case DirectionType.Left: + if (_startPosX.Value - Entityplane.Step > 0) + { + _startPosX -= (int)Entityplane.Step; + } + return true; + //вверх + case DirectionType.Up: + if (_startPosY.Value - Entityplane.Step > 0) + { + _startPosY -= (int)Entityplane.Step; + } + return true; + // вправо + case DirectionType.Right: + if (_startPosX.Value + _drawningplaneWidth + Entityplane.Step < _pictureWidth) + { + _startPosX += (int)Entityplane.Step; + } + return true; + //вниз + case DirectionType.Down: + if (_startPosY.Value + _drawningplaneHeight + Entityplane.Step < _pictureHeight) + { + _startPosY += (int)Entityplane.Step; + } + return true; + default: + return false; + } + } + /// + /// Прорисовка объекта + /// + /// + public virtual void DrawTransport(Graphics g) + { + if (Entityplane == null || !_startPosX.HasValue || !_startPosY.HasValue) + { + return; + } + + Pen pen = new(Color.Black); + + int f = 10; + //крыло верхнее самолета + g.DrawLine(pen, _startPosX.Value + 15 - f, _startPosY.Value + 5 - f, _startPosX.Value + 15 - f, _startPosY.Value + 5 - f); + g.DrawLine(pen, _startPosX.Value + 15 - f, _startPosY.Value + 5 - f, _startPosX.Value + 55 - f, _startPosY.Value + 35 - f); + g.DrawLine(pen, _startPosX.Value + 15 - f, _startPosY.Value + 35 - f, _startPosX.Value + 15 - f, _startPosY.Value + 5 - f); + + //задняя часть самолета полукруг + g.DrawArc(pen, _startPosX.Value + 5 - f, _startPosY.Value + 35 - f, 30, 30, 90, 180); + + //сзади + Brush bodybrush = new SolidBrush(Entityplane.BodyColor); + g.DrawEllipse(pen, _startPosX.Value + 10 - f, _startPosY.Value + 30 - f, 40, 10); + g.FillEllipse(bodybrush, _startPosX.Value + 10 - f, _startPosY.Value + 30 - f, 40, 10); + + //низ самолета + g.DrawLine(pen, _startPosX.Value + 16 - f, _startPosY.Value + 65 - f, _startPosX.Value + 135 - f, _startPosY.Value + 65 - f); + + // треуголник спереди + g.DrawLine(pen, _startPosX.Value + 135 - f, _startPosY.Value + 68 - f, _startPosX.Value + 135 - f, _startPosY.Value + 32 - f); + g.DrawLine(pen, _startPosX.Value + 135 - f, _startPosY.Value + 32 - f, _startPosX.Value + 160 - f, _startPosY.Value + 50 - f); + g.DrawLine(pen, _startPosX.Value + 135 - f, _startPosY.Value + 68 - f, _startPosX.Value + 160 - f, _startPosY.Value + 50 - f); + g.DrawLine(pen, _startPosX.Value + 135 - f, _startPosY.Value + 50 - f, _startPosX.Value + 160 - f, _startPosY.Value + 50 - f); + + //вверх от тругольника до треугольника + g.DrawLine(pen, _startPosX.Value + 50 - f, _startPosY.Value + 35 - f, _startPosX.Value + 135 - f, _startPosY.Value + 35 - f); + + //крыло + g.DrawEllipse(pen, _startPosX.Value + 50 - f, _startPosY.Value + 45 - f, 70, 10); + g.FillEllipse(bodybrush, _startPosX.Value + 50 - f, _startPosY.Value + 45 - f, 70, 10); + + //шасси + g.DrawLine(pen, _startPosX.Value + 35 - f, _startPosY.Value + 65 - f, _startPosX.Value + 35 - f, _startPosY.Value + 75 - f); + g.DrawLine(pen, _startPosX.Value + 120 - f, _startPosY.Value + 65 - f, _startPosX.Value + 120 - f, _startPosY.Value + 75 - f); + g.DrawLine(pen, _startPosX.Value + 25 - f, _startPosY.Value + 75 - f, _startPosX.Value + 45 - f, _startPosY.Value + 75 - f); + g.DrawEllipse(pen, _startPosX.Value + 15 - f, _startPosY.Value + 70 - f, 10, 10); + g.DrawEllipse(pen, _startPosX.Value + 45 - f, _startPosY.Value + 70 - f, 10, 10); + g.DrawEllipse(pen, _startPosX.Value + 115 - f, _startPosY.Value + 70 - f, 10, 10); + + } +} diff --git a/ProjectSportCar/ProjectSportCar/EntityAiroplane.cs b/ProjectSportCar/ProjectSportCar/Entities/EntityAiroplane.cs similarity index 58% rename from ProjectSportCar/ProjectSportCar/EntityAiroplane.cs rename to ProjectSportCar/ProjectSportCar/Entities/EntityAiroplane.cs index 37ea974..c72c239 100644 --- a/ProjectSportCar/ProjectSportCar/EntityAiroplane.cs +++ b/ProjectSportCar/ProjectSportCar/Entities/EntityAiroplane.cs @@ -1,18 +1,6 @@ -namespace ProjectAiroplane; -public class EntityAiroplane +namespace ProjectAiroplane.Entities; +public class EntityAiroplane : Entityplane { - /// - /// Скорость - /// - public int Speed { get; private set; } - /// - /// Вес - /// - public double Weight { get; private set; } - /// - /// Основной цвет - /// - public Color BodyColor { get; private set; } /// /// Дополнительный цвет (для опциональных элементов) /// @@ -23,14 +11,11 @@ public class EntityAiroplane public bool Toplivbak { get; private set; } /// /// Признак (опция) наличия радара - // - public bool Radar { get; private set; } - /// - /// Шаг перемещения самолета /// - public double Step => Speed * 100 / Weight; + public bool Radar { get; private set; } + /// - /// + /// Инициализация полей класса /// /// /// @@ -39,11 +24,8 @@ public class EntityAiroplane /// /// - public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool toplivbak, bool radar) + public EntityAiroplane(int speed, double weight, Color bodyColor, Color additionalColor, bool toplivbak, bool radar) : base(speed, weight, bodyColor) { - Speed = speed; - Weight = weight; - BodyColor = bodyColor; AdditionalColor = additionalColor; Toplivbak = toplivbak; Radar = radar; diff --git a/ProjectSportCar/ProjectSportCar/Entities/Entityplane.cs b/ProjectSportCar/ProjectSportCar/Entities/Entityplane.cs new file mode 100644 index 0000000..8dc6a33 --- /dev/null +++ b/ProjectSportCar/ProjectSportCar/Entities/Entityplane.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; + +namespace ProjectAiroplane.Entities; + +/// +/// Класс-сущность "Самолёт" +/// +public class Entityplane +{ + /// + /// Скорость + /// + public int Speed { get; private set; } + /// + /// Вес + /// + public double Weight { get; private set; } + /// + /// Основной цвет + /// + public Color BodyColor { get; private set; } + + /// + /// Шаг перемещения самолета + /// + public double Step => Speed * 100 / Weight; + /// + /// Конструктор сущности + /// + /// + /// + /// + + + public Entityplane(int speed, double weight, Color bodyColor) + { + Speed = speed; + Weight = weight; + BodyColor = bodyColor; + } + +} + diff --git a/ProjectSportCar/ProjectSportCar/FormAiroplane.Designer.cs b/ProjectSportCar/ProjectSportCar/FormAiroplane.Designer.cs index 4b81724..384b319 100644 --- a/ProjectSportCar/ProjectSportCar/FormAiroplane.Designer.cs +++ b/ProjectSportCar/ProjectSportCar/FormAiroplane.Designer.cs @@ -34,6 +34,9 @@ buttonUp = new Button(); buttonRight = new Button(); buttonDown = new Button(); + buttonCreatePlane = new Button(); + comboBoxStrategy = new ComboBox(); + Shag = new Button(); ((System.ComponentModel.ISupportInitialize)pictureBoxAiroplane).BeginInit(); SuspendLayout(); // @@ -42,74 +45,110 @@ pictureBoxAiroplane.Dock = DockStyle.Fill; pictureBoxAiroplane.Location = new Point(0, 0); pictureBoxAiroplane.Name = "pictureBoxAiroplane"; - pictureBoxAiroplane.Size = new Size(800, 450); + pictureBoxAiroplane.Size = new Size(807, 457); pictureBoxAiroplane.TabIndex = 0; pictureBoxAiroplane.TabStop = false; // // buttonCreate // buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; - buttonCreate.Location = new Point(12, 409); + buttonCreate.Location = new Point(12, 413); buttonCreate.Name = "buttonCreate"; - buttonCreate.Size = new Size(94, 29); + buttonCreate.Size = new Size(240, 29); buttonCreate.TabIndex = 1; - buttonCreate.Text = "Создать"; + buttonCreate.Text = "Создать самолёт с радаром"; buttonCreate.UseVisualStyleBackColor = true; - buttonCreate.Click += buttonCreate_Click; + buttonCreate.Click += ButtonCreate_Click; // // buttonLeft // buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonLeft.BackgroundImage = Properties.Resources.влево; buttonLeft.BackgroundImageLayout = ImageLayout.Stretch; - buttonLeft.Location = new Point(668, 406); + buttonLeft.Location = new Point(675, 413); buttonLeft.Name = "buttonLeft"; buttonLeft.Size = new Size(35, 35); buttonLeft.TabIndex = 2; buttonLeft.UseVisualStyleBackColor = true; - buttonLeft.Click += buttonMove_Click; + buttonLeft.Click += ButtonMove_Click; // // buttonUp // buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonUp.BackgroundImage = Properties.Resources.вверх; buttonUp.BackgroundImageLayout = ImageLayout.Stretch; - buttonUp.Location = new Point(709, 365); + buttonUp.Location = new Point(716, 372); buttonUp.Name = "buttonUp"; buttonUp.Size = new Size(35, 35); buttonUp.TabIndex = 3; buttonUp.UseVisualStyleBackColor = true; - buttonUp.Click += buttonMove_Click; + buttonUp.Click += ButtonMove_Click; // // buttonRight // buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonRight.BackgroundImage = Properties.Resources.вправо; buttonRight.BackgroundImageLayout = ImageLayout.Stretch; - buttonRight.Location = new Point(750, 406); + buttonRight.Location = new Point(757, 413); buttonRight.Name = "buttonRight"; buttonRight.Size = new Size(35, 35); buttonRight.TabIndex = 4; buttonRight.UseVisualStyleBackColor = true; - buttonRight.Click += buttonMove_Click; + buttonRight.Click += ButtonMove_Click; // // buttonDown // buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonDown.BackgroundImage = Properties.Resources.вниз; buttonDown.BackgroundImageLayout = ImageLayout.Stretch; - buttonDown.Location = new Point(709, 406); + buttonDown.Location = new Point(716, 413); buttonDown.Name = "buttonDown"; buttonDown.Size = new Size(35, 35); buttonDown.TabIndex = 5; buttonDown.UseVisualStyleBackColor = true; - buttonDown.Click += buttonMove_Click; + buttonDown.Click += ButtonMove_Click; + // + // buttonCreatePlane + // + buttonCreatePlane.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + buttonCreatePlane.Location = new Point(263, 413); + buttonCreatePlane.Name = "buttonCreatePlane"; + buttonCreatePlane.Size = new Size(208, 29); + buttonCreatePlane.TabIndex = 6; + buttonCreatePlane.Text = "Создать самолёт"; + buttonCreatePlane.UseVisualStyleBackColor = true; + buttonCreatePlane.Click += ButtonCreateplane_Click; + // + // comboBoxStrategy + // + comboBoxStrategy.Anchor = AnchorStyles.Top | AnchorStyles.Right; + comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxStrategy.FormattingEnabled = true; + comboBoxStrategy.Items.AddRange(new object[] { "К центру", "К краю" }); + comboBoxStrategy.Location = new Point(644, 12); + comboBoxStrategy.Name = "comboBoxStrategy"; + comboBoxStrategy.Size = new Size(151, 28); + comboBoxStrategy.TabIndex = 7; + // + // Shag + // + Shag.Anchor = AnchorStyles.Top | AnchorStyles.Right; + Shag.Location = new Point(716, 46); + Shag.Name = "Shag"; + Shag.Size = new Size(76, 32); + Shag.TabIndex = 8; + Shag.Text = "Шаг"; + Shag.UseVisualStyleBackColor = true; + Shag.Click += ButtonStrategyStep_Click; // // FormAiroplane // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); + ClientSize = new Size(807, 457); + Controls.Add(Shag); + Controls.Add(comboBoxStrategy); + Controls.Add(buttonCreatePlane); Controls.Add(buttonDown); Controls.Add(buttonRight); Controls.Add(buttonUp); @@ -130,5 +169,8 @@ private Button buttonUp; private Button buttonRight; private Button buttonDown; + private Button buttonCreatePlane; + private ComboBox comboBoxStrategy; + private Button Shag; } } \ No newline at end of file diff --git a/ProjectSportCar/ProjectSportCar/FormAiroplane.cs b/ProjectSportCar/ProjectSportCar/FormAiroplane.cs index 9414b78..92225f5 100644 --- a/ProjectSportCar/ProjectSportCar/FormAiroplane.cs +++ b/ProjectSportCar/ProjectSportCar/FormAiroplane.cs @@ -1,78 +1,149 @@ -namespace ProjectAiroplane; +using ProjectAiroplane.Drawnings; +using ProjectAiroplane.MovementStrategy; -public partial class FormAiroplane : Form +namespace ProjectAiroplane { - private DrawningAiroplane? _drawningAiroplane; - - - public FormAiroplane() + public partial class FormAiroplane : Form { - InitializeComponent(); - } - - private void Draw() - { - if (_drawningAiroplane == null) + private Drawningplane? _drawningplane; + private AbstractStrategy? _strategy; + public FormAiroplane() { - return; + InitializeComponent(); + _strategy = null; } - Bitmap bmp = new(pictureBoxAiroplane.Width, pictureBoxAiroplane.Height); - Graphics gr = Graphics.FromImage(bmp); - _drawningAiroplane.DrawTransport(gr); - pictureBoxAiroplane.Image = bmp; - } - - private void buttonCreate_Click(object sender, EventArgs e) - { - Random random = new(); - _drawningAiroplane = new DrawningAiroplane(); - - _drawningAiroplane.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))); - _drawningAiroplane.SetPictureSize(pictureBoxAiroplane.Width, pictureBoxAiroplane.Height); - _drawningAiroplane.SetPosition(random.Next(10, 100), random.Next(10, 100)); - - Draw(); - } - - /// - /// Перемещение объекта по форме (нажатие кнопок навигации) - /// - /// - /// - - private void buttonMove_Click(object sender, EventArgs e) - { - if (_drawningAiroplane == null) + private void Draw() { - return; + if (_drawningplane == null) + { + return; + } + Bitmap bmp = new(pictureBoxAiroplane.Width, pictureBoxAiroplane.Height); + Graphics gr = Graphics.FromImage(bmp); + _drawningplane.DrawTransport(gr); + pictureBoxAiroplane.Image = bmp; } - string name = ((Button)sender)?.Name ?? string.Empty; - bool result = false; - switch (name) - { - case "buttonUp": - result = _drawningAiroplane.MoveTransport(DirectionType.Up); - break; - case "buttonDown": - result = _drawningAiroplane.MoveTransport(DirectionType.Down); - break; - case "buttonLeft": - result = _drawningAiroplane.MoveTransport(DirectionType.Left); - break; - case "buttonRight": - result = _drawningAiroplane.MoveTransport(DirectionType.Right); - break; - } - if (result) + + private void CreateObject(string type) { + Random random = new Random(); + switch (type) + { + case nameof(Drawningplane): + _drawningplane = new Drawningplane(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(DrawningAiroplane): + _drawningplane = new DrawningAiroplane(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; + } + _drawningplane.SetPictureSize(pictureBoxAiroplane.Width, pictureBoxAiroplane.Height); + _drawningplane.SetPosition(random.Next(10, 100), random.Next(10, 100)); + _strategy = null; + comboBoxStrategy.Enabled = true; Draw(); } - } + /// + /// Кнопка создания самолета + /// + /// + /// + private void ButtonCreate_Click(object sender, EventArgs e) + { + CreateObject(nameof(DrawningAiroplane)); + } + ///// + ///// Кнопка создания самолета с радаром "Создать самолет с радаром" + ///// + ///// + ///// + //private void ButtonCreateAiroplane_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningAiroplane)); + + /// + /// Кнопка создания самолета "Создать" + /// + /// + /// + + private void ButtonCreateplane_Click(object sender, EventArgs e) => CreateObject(nameof(Drawningplane)); + + /// + /// Перемещение объекта по форме (нажатие кнопок навигации) + /// + /// + /// + + private void ButtonMove_Click(object sender, EventArgs e) + { + if (_drawningplane == null) + { + return; + } + string name = ((Button)sender)?.Name ?? string.Empty; + bool result = false; + switch (name) + { + case "buttonUp": + result = _drawningplane.MoveTransport(DirectionType.Up); + break; + case "buttonDown": + result = _drawningplane.MoveTransport(DirectionType.Down); + break; + case "buttonLeft": + result = _drawningplane.MoveTransport(DirectionType.Left); + break; + case "buttonRight": + result = _drawningplane.MoveTransport(DirectionType.Right); + break; + } + if (result) + { + Draw(); + } + } + + private void ButtonStrategyStep_Click(object sender, EventArgs e) + { + if (_drawningplane == null) + { + return; + } + if (comboBoxStrategy.Enabled) + { + _strategy = comboBoxStrategy.SelectedIndex switch + { + 0 => new MoveToCenter(), + 1 => new MoveToBorder(), + _ => null, + }; + if (_strategy == null) + { + return; + } + _strategy.SetData(new Moveableplane(_drawningplane), + pictureBoxAiroplane.Width, pictureBoxAiroplane.Height); + } + if (_strategy == null) + { + return; + } + comboBoxStrategy.Enabled = false; + _strategy.MakeStep(); + Draw(); + if (_strategy.GetStatus == StrategyStatus.Finish) + { + comboBoxStrategy.Enabled = true; + _strategy = null; + } + } + } } diff --git a/ProjectSportCar/ProjectSportCar/MovementStrategy/AbstractStrategy.cs b/ProjectSportCar/ProjectSportCar/MovementStrategy/AbstractStrategy.cs new file mode 100644 index 0000000..3e3f83b --- /dev/null +++ b/ProjectSportCar/ProjectSportCar/MovementStrategy/AbstractStrategy.cs @@ -0,0 +1,121 @@ +namespace ProjectAiroplane.MovementStrategy; + +public abstract class AbstractStrategy +{ + /// + /// Перемещаемый объект + /// + private IMoveableObjects? _moveableObject; + /// + /// Статус перемещения + /// + private StrategyStatus _state = StrategyStatus.NotInit; + /// + /// Ширина поля + /// + protected int FieldWidth { get; private set; } + /// + /// Высота поля + /// + protected int FieldHeight { get; private set; } + /// + /// Статус перемещения + /// + public StrategyStatus GetStatus { get { return _state; } } + /// + /// Установка данных + /// + /// + /// + /// + public void SetData(IMoveableObjects moveableObjects, int width, int height) + { + if (moveableObjects == null) + { + _state = StrategyStatus.NotInit; + return; + } + _state = StrategyStatus.InProgress; + _moveableObject = moveableObjects; + FieldWidth = width; + FieldHeight = height; + } + /// + /// Шаг перемещения + /// + public void MakeStep() + { + if (_state != StrategyStatus.InProgress) return; + if (IsTargetDestinaion())//вызов абстрактного метода + { + _state = StrategyStatus.Finish; + return; + } + MoveToTarget();// место вызова абстрактного метода + } + + //public void Method()// + //{ + // AbstrMethod(); + //} + + protected abstract void AbstrMethod(); + /// + /// Перемещение влево + /// + /// Результат перемещения (true - удалось переместиться, false -неудача) + protected bool MoveLeft() => MoveTo(MovementDirection.Left); + /// + /// Перемещение вправо + /// + /// Результат перемещения (true - удалось переместиться, false -неудача) + protected bool MoveRight() => MoveTo(MovementDirection.Right); + /// + /// Перемещение вверх + /// + /// Результат перемещения (true - удалось переместиться, false -неудача) + protected bool MoveUp() => MoveTo(MovementDirection.Up); + /// + /// Перемещение вниз + /// + /// Результат перемещения (true - удалось переместиться, false -неудача) + protected bool MoveDown() => MoveTo(MovementDirection.Down); + /// + /// Параметры объекта + /// + protected ObjectParameters? GetObjectParameters => _moveableObject?.GetObjectPosition; + /// + /// Шаг объекта + /// + /// + protected int? GetStep() + { + if (_state != StrategyStatus.InProgress) + { + return null; + } + return _moveableObject?.GetStep; + } + /// + /// Перемещение к цели + /// + protected abstract void MoveToTarget();//Абстрактный метод + /// + /// Достигнута ли цель + /// + /// + protected abstract bool IsTargetDestinaion();//Абстрактный метод + /// + /// Попытка перемещения в требуемом направлении + /// + /// Направление + /// Результат попытки (true - удалось переместиться, false -неудача) + private bool MoveTo(MovementDirection movementDirection) + { + if (_state != StrategyStatus.InProgress) + { + return false; + } + return _moveableObject?.TryMoveObject(movementDirection) ?? false; + } +} \ No newline at end of file diff --git a/ProjectSportCar/ProjectSportCar/MovementStrategy/IMoveableObjects.cs b/ProjectSportCar/ProjectSportCar/MovementStrategy/IMoveableObjects.cs new file mode 100644 index 0000000..4efe168 --- /dev/null +++ b/ProjectSportCar/ProjectSportCar/MovementStrategy/IMoveableObjects.cs @@ -0,0 +1,16 @@ +namespace ProjectAiroplane.MovementStrategy; + +public interface IMoveableObjects +{ + ObjectParameters? GetObjectPosition { get; } + /// + /// Шаг объекта + /// + int GetStep { get; } + /// + /// Попытка переместить объект в указанном направлении + /// + /// + /// + bool TryMoveObject(MovementDirection direction); +} \ No newline at end of file diff --git a/ProjectSportCar/ProjectSportCar/MovementStrategy/MoveToBorder.cs b/ProjectSportCar/ProjectSportCar/MovementStrategy/MoveToBorder.cs new file mode 100644 index 0000000..3c134d5 --- /dev/null +++ b/ProjectSportCar/ProjectSportCar/MovementStrategy/MoveToBorder.cs @@ -0,0 +1,36 @@ +namespace ProjectAiroplane.MovementStrategy; + +public class MoveToBorder : AbstractStrategy +{ + protected override void AbstrMethod()// + { + var str = "Отчислить"; + } + + protected override bool IsTargetDestinaion()//реализация абстрактного метода + { + ObjectParameters? objParams = GetObjectParameters; + if (objParams == null) + { + return false; + } + return objParams.LeftBorder - GetStep() <= 0 || + objParams.RightBorder + GetStep() >= FieldWidth || + objParams.TopBorder - GetStep() <= 0 + || objParams.ObjectMiddleVertical + GetStep() >= FieldHeight; + } + + protected override void MoveToTarget()//реализация абстрактного метода + { + ObjectParameters? objParams = GetObjectParameters; + if (objParams == null) + { + return; + } + //реализация в правый нижний угол + int x = objParams.RightBorder; + if (x + GetStep() < FieldWidth) MoveRight(); + int y = objParams.DownBorder; + if (y + GetStep() < FieldHeight) MoveDown(); + } +} \ No newline at end of file diff --git a/ProjectSportCar/ProjectSportCar/MovementStrategy/MoveToCenter.cs b/ProjectSportCar/ProjectSportCar/MovementStrategy/MoveToCenter.cs new file mode 100644 index 0000000..a5bd0f5 --- /dev/null +++ b/ProjectSportCar/ProjectSportCar/MovementStrategy/MoveToCenter.cs @@ -0,0 +1,54 @@ +namespace ProjectAiroplane.MovementStrategy; + +public class MoveToCenter : AbstractStrategy +{ + protected override void AbstrMethod()// + { + var str = "Перевести"; + } + + protected override bool IsTargetDestinaion()//реализация абстрактного метода + { + ObjectParameters? objParams = GetObjectParameters; + if (objParams == null) + { + return false; + } + return objParams.ObjectMiddleHorizontal - GetStep() <= FieldWidth / 2 && + objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 && + objParams.ObjectMiddleVertical - GetStep() <= FieldHeight / 2 + && objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2; + } + protected override void MoveToTarget() + { + ObjectParameters? objParams = GetObjectParameters; + if (objParams == null) + { + return; + } + int diffX = objParams.ObjectMiddleHorizontal - FieldWidth / 2; + if (Math.Abs(diffX) > GetStep()) + { + if (diffX > 0) + { + MoveLeft(); + } + else + { + MoveRight(); + } + } + int diffY = objParams.ObjectMiddleVertical - FieldHeight / 2; + if (Math.Abs(diffY) > GetStep()) + { + if (diffY > 0) + { + MoveUp(); + } + else + { + MoveDown(); + } + } + } +} diff --git a/ProjectSportCar/ProjectSportCar/MovementStrategy/Moveableplane.cs b/ProjectSportCar/ProjectSportCar/MovementStrategy/Moveableplane.cs new file mode 100644 index 0000000..bba99eb --- /dev/null +++ b/ProjectSportCar/ProjectSportCar/MovementStrategy/Moveableplane.cs @@ -0,0 +1,49 @@ +using ProjectAiroplane.Drawnings; + + +namespace ProjectAiroplane.MovementStrategy; + +public class Moveableplane : IMoveableObjects +{ + private Drawningplane? _drawningplane; + public Moveableplane(Drawningplane? drawningplane) + { + _drawningplane = drawningplane; + } + public ObjectParameters? GetObjectPosition + { + get + { + if (_drawningplane == null || _drawningplane.Entityplane == null || !_drawningplane.GetPosX.HasValue || !_drawningplane.GetPosY.HasValue) + { + return null; + } + return new ObjectParameters(_drawningplane.GetPosX.Value, _drawningplane.GetPosY.Value, _drawningplane.GetWidth, _drawningplane.GetHeight); + } + } + public int GetStep => (int)(_drawningplane?.Entityplane?.Step ?? 0); + public bool TryMoveObject(MovementDirection direction) + { + if (_drawningplane == null || _drawningplane.Entityplane == null) + { + return false; + } + return _drawningplane.MoveTransport(GetDirectionType(direction)); + } + /// + /// Конвертация из MovementDirection в DirectionType + /// + /// MovementDirection + /// DirectionType + private static DirectionType GetDirectionType(MovementDirection direction) + { + return direction switch + { + MovementDirection.Left => DirectionType.Left, + MovementDirection.Right => DirectionType.Right, + MovementDirection.Up => DirectionType.Up, + MovementDirection.Down => DirectionType.Down, + _ => DirectionType.Unknow, + }; + } +} \ No newline at end of file diff --git a/ProjectSportCar/ProjectSportCar/MovementStrategy/MovementDirection.cs b/ProjectSportCar/ProjectSportCar/MovementStrategy/MovementDirection.cs new file mode 100644 index 0000000..3c88b89 --- /dev/null +++ b/ProjectSportCar/ProjectSportCar/MovementStrategy/MovementDirection.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAiroplane.MovementStrategy; +public enum MovementDirection +{ + /// + /// Вверх + /// + Up = 1, + /// + /// Вниз + /// + Down = 2, + /// + /// Влево + /// + Left = 3, + /// + /// Вправо + /// + Right = 4 +} \ No newline at end of file diff --git a/ProjectSportCar/ProjectSportCar/MovementStrategy/ObjectParameters.cs b/ProjectSportCar/ProjectSportCar/MovementStrategy/ObjectParameters.cs new file mode 100644 index 0000000..e9c1d28 --- /dev/null +++ b/ProjectSportCar/ProjectSportCar/MovementStrategy/ObjectParameters.cs @@ -0,0 +1,60 @@ +namespace ProjectAiroplane.MovementStrategy; + + +public class ObjectParameters +{ + /// + /// Координата х + /// + private readonly int _x; + /// + /// Координата у + /// + private readonly int _y; + /// + /// Ширина объекта + /// + private readonly int _width; + /// + /// Высота объекта + /// + private readonly int _height; + /// + /// Левая граница + /// + public int LeftBorder => _x; + /// + /// Правая граница + /// + public int TopBorder => _y; + /// + /// Правая граница + /// + public int RightBorder => _x + _width; + /// + /// Нижняя граница + /// + public int DownBorder => _y + _height; + /// + /// Середина объекта + /// + public int ObjectMiddleHorizontal => _x + _width / 2; + /// + /// Середина объекта + /// + public int ObjectMiddleVertical => _y + _height / 2; + /// + /// Конструктор + /// + /// + /// + /// + /// + public ObjectParameters(int x, int y, int width, int height) + { + _x = x; + _y = y; + _width = width; + _height = height; + } +} diff --git a/ProjectSportCar/ProjectSportCar/MovementStrategy/StrategyStatus.cs b/ProjectSportCar/ProjectSportCar/MovementStrategy/StrategyStatus.cs new file mode 100644 index 0000000..02bc711 --- /dev/null +++ b/ProjectSportCar/ProjectSportCar/MovementStrategy/StrategyStatus.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAiroplane.MovementStrategy; +public enum StrategyStatus +{ + /// + /// Все готово к началу + /// + NotInit, + /// + /// Выполняется + /// + InProgress, + // Завершена + Finish +} \ No newline at end of file