Лаб 2
This commit is contained in:
parent
874e2f1c63
commit
26ce39f91a
@ -1,250 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectAiroplane;
|
|
||||||
/// <summary>
|
|
||||||
/// Класс отвечающий за прорисовку и перемещение объекта-сущности
|
|
||||||
/// </summary>
|
|
||||||
public class DrawningAiroplane
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Класс-сущность
|
|
||||||
/// </summary>
|
|
||||||
public EntityAiroplane? EntityAiroplane { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Ширина окна
|
|
||||||
/// </summary>
|
|
||||||
private int? _pictureWidth;
|
|
||||||
/// <summary>
|
|
||||||
/// Высота окна
|
|
||||||
/// </summary>
|
|
||||||
private int? _pictureHeight;
|
|
||||||
/// <summary>
|
|
||||||
/// Левая координата прорисовки
|
|
||||||
/// </summary>
|
|
||||||
private int? _startPosX;
|
|
||||||
/// <summary>
|
|
||||||
/// Верхняя кооридната прорисовки
|
|
||||||
/// </summary>
|
|
||||||
private int? _startPosY;
|
|
||||||
/// <summary>
|
|
||||||
/// Ширина прорисовки
|
|
||||||
/// </summary>
|
|
||||||
private readonly int _drawningAiroplaneWidth = 160;
|
|
||||||
/// <summary>
|
|
||||||
/// Высота прорисовки
|
|
||||||
/// </summary>
|
|
||||||
private readonly int _drawningaAiroplaneHeight = 80;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Инициализация свойств
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="speed">Скорость</param>
|
|
||||||
/// <param name="weight">Вес</param>
|
|
||||||
/// <param name="bodyColor">Основной цвет</param>
|
|
||||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
|
||||||
/// <param name="toplivbak">Признак наличия бака</param>
|
|
||||||
/// <param name="radar">Признак наличия радара</param>
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Установка границ поля
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="width">Ширина поля</param>
|
|
||||||
/// <param name="height">Высота поля</param>
|
|
||||||
/// <returns>true - границы заданы, false - проверка не пройдена, нельзя разместить объект в этих размерах</returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Установка позиции
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="x">Координата X</param>
|
|
||||||
/// <param name="y">Координата Y</param>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Изменение направления перемещения
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="direction">Направление</param>
|
|
||||||
/// <returns>true - перемещене выполнено, false - перемещение невозможно</returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Прорисовка объекта
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="g"></param>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
|||||||
namespace ProjectAiroplane;
|
namespace ProjectAiroplane.Drawnings;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Направление перемещения
|
/// Направление перемещения
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum DirectionType
|
public enum DirectionType
|
||||||
{
|
{ /// <summary>
|
||||||
|
/// Неизвестное направление
|
||||||
|
/// </summary>
|
||||||
|
Unknow = -1,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Вверх
|
/// Вверх
|
||||||
/// </summary>
|
/// </summary>
|
@ -0,0 +1,58 @@
|
|||||||
|
using ProjectAiroplane.Entities;
|
||||||
|
|
||||||
|
namespace ProjectAiroplane.Drawnings;
|
||||||
|
/// <summary>
|
||||||
|
/// Класс отвечающий за прорисовку и перемещение объекта-сущности
|
||||||
|
/// </summary>
|
||||||
|
public class DrawningAiroplane : Drawningplane
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
|
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||||
|
/// <param name="toplivbak">Признак наличия бака</param>
|
||||||
|
/// <param name="radar">Признак наличия радара</param>
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
269
ProjectSportCar/ProjectSportCar/Drawnings/Drawningplane.cs
Normal file
269
ProjectSportCar/ProjectSportCar/Drawnings/Drawningplane.cs
Normal file
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Класс-сущность
|
||||||
|
/// </summary>
|
||||||
|
public Entityplane? Entityplane { get; protected set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина окна
|
||||||
|
/// </summary>
|
||||||
|
private int? _pictureWidth;
|
||||||
|
/// <summary>
|
||||||
|
/// Высота окна
|
||||||
|
/// </summary>
|
||||||
|
private int? _pictureHeight;
|
||||||
|
/// <summary>
|
||||||
|
/// Левая координата прорисовки
|
||||||
|
/// </summary>
|
||||||
|
protected int? _startPosX;
|
||||||
|
/// <summary>
|
||||||
|
/// Верхняя кооридната прорисовки
|
||||||
|
/// </summary>
|
||||||
|
protected int? _startPosY;
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина прорисовки
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _drawningplaneWidth = 168;
|
||||||
|
/// <summary>
|
||||||
|
/// Высота прорисовки
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _drawningplaneHeight = 80;
|
||||||
|
|
||||||
|
// <summary>
|
||||||
|
/// Координата X объекта
|
||||||
|
/// </summary>
|
||||||
|
public int? GetPosX => _startPosX;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Координата Y объекта
|
||||||
|
/// </summary>
|
||||||
|
public int? GetPosY => _startPosY;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина объекта
|
||||||
|
/// </summary>
|
||||||
|
public int GetWidth => _drawningplaneWidth;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Высота объекта
|
||||||
|
/// </summary>
|
||||||
|
public int GetHeight => _drawningplaneHeight;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Пустой конструктор
|
||||||
|
/// </summary>
|
||||||
|
private Drawningplane()
|
||||||
|
{
|
||||||
|
_pictureWidth = null;
|
||||||
|
_pictureHeight = null;
|
||||||
|
_startPosX = null;
|
||||||
|
_startPosY = null;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
|
|
||||||
|
public Drawningplane(int speed, double weight, Color bodyColor) : this()
|
||||||
|
{
|
||||||
|
Entityplane = new Entityplane(speed, weight, bodyColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор для наследников
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="_drawningplaneWidth">Ширина прорисовки </param>
|
||||||
|
/// <param name="_drawningplaneHeight">Высота прорисовки</param>
|
||||||
|
|
||||||
|
protected Drawningplane(int _drawningplaneWidth, int _drawningplaneHeight) : this()
|
||||||
|
{
|
||||||
|
_pictureWidth = _drawningplaneWidth;/// tut posmotret
|
||||||
|
_pictureHeight = _drawningplaneHeight;
|
||||||
|
|
||||||
|
_pictureWidth = null;
|
||||||
|
_pictureHeight = null;
|
||||||
|
_startPosX = null;
|
||||||
|
_startPosY = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Установка границ поля
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="width">Ширина поля</param>
|
||||||
|
/// <param name="height">Высота поля</param>
|
||||||
|
/// <returns>true - границы заданы, false - проверка не пройдена, нельзя разместить объект в этих размерах</returns>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Установка позиции
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x">Координата X</param>
|
||||||
|
/// <param name="y">Координата Y</param>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Изменение направления перемещения
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="direction">Направление</param>
|
||||||
|
/// <returns>true - перемещене выполнено, false - перемещение невозможно</returns>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Прорисовка объекта
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="g"></param>
|
||||||
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,18 +1,6 @@
|
|||||||
namespace ProjectAiroplane;
|
namespace ProjectAiroplane.Entities;
|
||||||
public class EntityAiroplane
|
public class EntityAiroplane : Entityplane
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Скорость
|
|
||||||
/// </summary>
|
|
||||||
public int Speed { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Вес
|
|
||||||
/// </summary>
|
|
||||||
public double Weight { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Основной цвет
|
|
||||||
/// </summary>
|
|
||||||
public Color BodyColor { get; private set; }
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дополнительный цвет (для опциональных элементов)
|
/// Дополнительный цвет (для опциональных элементов)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -23,14 +11,11 @@ public class EntityAiroplane
|
|||||||
public bool Toplivbak { get; private set; }
|
public bool Toplivbak { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Признак (опция) наличия радара
|
/// Признак (опция) наличия радара
|
||||||
// </summary>
|
|
||||||
public bool Radar { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Шаг перемещения самолета
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double Step => Speed * 100 / Weight;
|
public bool Radar { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Инициализация полей класса
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="speed"></скорость>
|
/// <param name="speed"></скорость>
|
||||||
/// <param name="weight"></вес>
|
/// <param name="weight"></вес>
|
||||||
@ -39,11 +24,8 @@ public class EntityAiroplane
|
|||||||
/// <param name="toplivbak"></ Признак наличия бака>
|
/// <param name="toplivbak"></ Признак наличия бака>
|
||||||
/// <param name="radar"></Признак (опция) наличия радара>
|
/// <param name="radar"></Признак (опция) наличия радара>
|
||||||
|
|
||||||
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;
|
AdditionalColor = additionalColor;
|
||||||
Toplivbak = toplivbak;
|
Toplivbak = toplivbak;
|
||||||
Radar = radar;
|
Radar = radar;
|
48
ProjectSportCar/ProjectSportCar/Entities/Entityplane.cs
Normal file
48
ProjectSportCar/ProjectSportCar/Entities/Entityplane.cs
Normal file
@ -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;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Класс-сущность "Самолёт"
|
||||||
|
/// </summary>
|
||||||
|
public class Entityplane
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Скорость
|
||||||
|
/// </summary>
|
||||||
|
public int Speed { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Вес
|
||||||
|
/// </summary>
|
||||||
|
public double Weight { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Основной цвет
|
||||||
|
/// </summary>
|
||||||
|
public Color BodyColor { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Шаг перемещения самолета
|
||||||
|
/// </summary>
|
||||||
|
public double Step => Speed * 100 / Weight;
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор сущности
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed"></скорость>
|
||||||
|
/// <param name="weight"></вес>
|
||||||
|
/// <param name="bodyColor"></Основной цвет>
|
||||||
|
|
||||||
|
|
||||||
|
public Entityplane(int speed, double weight, Color bodyColor)
|
||||||
|
{
|
||||||
|
Speed = speed;
|
||||||
|
Weight = weight;
|
||||||
|
BodyColor = bodyColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -34,6 +34,9 @@
|
|||||||
buttonUp = new Button();
|
buttonUp = new Button();
|
||||||
buttonRight = new Button();
|
buttonRight = new Button();
|
||||||
buttonDown = new Button();
|
buttonDown = new Button();
|
||||||
|
buttonCreatePlane = new Button();
|
||||||
|
comboBoxStrategy = new ComboBox();
|
||||||
|
Shag = new Button();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxAiroplane).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureBoxAiroplane).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
@ -42,74 +45,110 @@
|
|||||||
pictureBoxAiroplane.Dock = DockStyle.Fill;
|
pictureBoxAiroplane.Dock = DockStyle.Fill;
|
||||||
pictureBoxAiroplane.Location = new Point(0, 0);
|
pictureBoxAiroplane.Location = new Point(0, 0);
|
||||||
pictureBoxAiroplane.Name = "pictureBoxAiroplane";
|
pictureBoxAiroplane.Name = "pictureBoxAiroplane";
|
||||||
pictureBoxAiroplane.Size = new Size(800, 450);
|
pictureBoxAiroplane.Size = new Size(807, 457);
|
||||||
pictureBoxAiroplane.TabIndex = 0;
|
pictureBoxAiroplane.TabIndex = 0;
|
||||||
pictureBoxAiroplane.TabStop = false;
|
pictureBoxAiroplane.TabStop = false;
|
||||||
//
|
//
|
||||||
// buttonCreate
|
// buttonCreate
|
||||||
//
|
//
|
||||||
buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
buttonCreate.Location = new Point(12, 409);
|
buttonCreate.Location = new Point(12, 413);
|
||||||
buttonCreate.Name = "buttonCreate";
|
buttonCreate.Name = "buttonCreate";
|
||||||
buttonCreate.Size = new Size(94, 29);
|
buttonCreate.Size = new Size(240, 29);
|
||||||
buttonCreate.TabIndex = 1;
|
buttonCreate.TabIndex = 1;
|
||||||
buttonCreate.Text = "Создать";
|
buttonCreate.Text = "Создать самолёт с радаром";
|
||||||
buttonCreate.UseVisualStyleBackColor = true;
|
buttonCreate.UseVisualStyleBackColor = true;
|
||||||
buttonCreate.Click += buttonCreate_Click;
|
buttonCreate.Click += ButtonCreate_Click;
|
||||||
//
|
//
|
||||||
// buttonLeft
|
// buttonLeft
|
||||||
//
|
//
|
||||||
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
buttonLeft.BackgroundImage = Properties.Resources.влево;
|
buttonLeft.BackgroundImage = Properties.Resources.влево;
|
||||||
buttonLeft.BackgroundImageLayout = ImageLayout.Stretch;
|
buttonLeft.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
buttonLeft.Location = new Point(668, 406);
|
buttonLeft.Location = new Point(675, 413);
|
||||||
buttonLeft.Name = "buttonLeft";
|
buttonLeft.Name = "buttonLeft";
|
||||||
buttonLeft.Size = new Size(35, 35);
|
buttonLeft.Size = new Size(35, 35);
|
||||||
buttonLeft.TabIndex = 2;
|
buttonLeft.TabIndex = 2;
|
||||||
buttonLeft.UseVisualStyleBackColor = true;
|
buttonLeft.UseVisualStyleBackColor = true;
|
||||||
buttonLeft.Click += buttonMove_Click;
|
buttonLeft.Click += ButtonMove_Click;
|
||||||
//
|
//
|
||||||
// buttonUp
|
// buttonUp
|
||||||
//
|
//
|
||||||
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
buttonUp.BackgroundImage = Properties.Resources.вверх;
|
buttonUp.BackgroundImage = Properties.Resources.вверх;
|
||||||
buttonUp.BackgroundImageLayout = ImageLayout.Stretch;
|
buttonUp.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
buttonUp.Location = new Point(709, 365);
|
buttonUp.Location = new Point(716, 372);
|
||||||
buttonUp.Name = "buttonUp";
|
buttonUp.Name = "buttonUp";
|
||||||
buttonUp.Size = new Size(35, 35);
|
buttonUp.Size = new Size(35, 35);
|
||||||
buttonUp.TabIndex = 3;
|
buttonUp.TabIndex = 3;
|
||||||
buttonUp.UseVisualStyleBackColor = true;
|
buttonUp.UseVisualStyleBackColor = true;
|
||||||
buttonUp.Click += buttonMove_Click;
|
buttonUp.Click += ButtonMove_Click;
|
||||||
//
|
//
|
||||||
// buttonRight
|
// buttonRight
|
||||||
//
|
//
|
||||||
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
buttonRight.BackgroundImage = Properties.Resources.вправо;
|
buttonRight.BackgroundImage = Properties.Resources.вправо;
|
||||||
buttonRight.BackgroundImageLayout = ImageLayout.Stretch;
|
buttonRight.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
buttonRight.Location = new Point(750, 406);
|
buttonRight.Location = new Point(757, 413);
|
||||||
buttonRight.Name = "buttonRight";
|
buttonRight.Name = "buttonRight";
|
||||||
buttonRight.Size = new Size(35, 35);
|
buttonRight.Size = new Size(35, 35);
|
||||||
buttonRight.TabIndex = 4;
|
buttonRight.TabIndex = 4;
|
||||||
buttonRight.UseVisualStyleBackColor = true;
|
buttonRight.UseVisualStyleBackColor = true;
|
||||||
buttonRight.Click += buttonMove_Click;
|
buttonRight.Click += ButtonMove_Click;
|
||||||
//
|
//
|
||||||
// buttonDown
|
// buttonDown
|
||||||
//
|
//
|
||||||
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
buttonDown.BackgroundImage = Properties.Resources.вниз;
|
buttonDown.BackgroundImage = Properties.Resources.вниз;
|
||||||
buttonDown.BackgroundImageLayout = ImageLayout.Stretch;
|
buttonDown.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
buttonDown.Location = new Point(709, 406);
|
buttonDown.Location = new Point(716, 413);
|
||||||
buttonDown.Name = "buttonDown";
|
buttonDown.Name = "buttonDown";
|
||||||
buttonDown.Size = new Size(35, 35);
|
buttonDown.Size = new Size(35, 35);
|
||||||
buttonDown.TabIndex = 5;
|
buttonDown.TabIndex = 5;
|
||||||
buttonDown.UseVisualStyleBackColor = true;
|
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
|
// FormAiroplane
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
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(buttonDown);
|
||||||
Controls.Add(buttonRight);
|
Controls.Add(buttonRight);
|
||||||
Controls.Add(buttonUp);
|
Controls.Add(buttonUp);
|
||||||
@ -130,5 +169,8 @@
|
|||||||
private Button buttonUp;
|
private Button buttonUp;
|
||||||
private Button buttonRight;
|
private Button buttonRight;
|
||||||
private Button buttonDown;
|
private Button buttonDown;
|
||||||
|
private Button buttonCreatePlane;
|
||||||
|
private ComboBox comboBoxStrategy;
|
||||||
|
private Button Shag;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,78 +1,149 @@
|
|||||||
namespace ProjectAiroplane;
|
using ProjectAiroplane.Drawnings;
|
||||||
|
using ProjectAiroplane.MovementStrategy;
|
||||||
|
|
||||||
public partial class FormAiroplane : Form
|
namespace ProjectAiroplane
|
||||||
{
|
{
|
||||||
private DrawningAiroplane? _drawningAiroplane;
|
|
||||||
|
|
||||||
|
public partial class FormAiroplane : Form
|
||||||
|
|
||||||
public FormAiroplane()
|
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
private Drawningplane? _drawningplane;
|
||||||
}
|
private AbstractStrategy? _strategy;
|
||||||
|
public FormAiroplane()
|
||||||
private void Draw()
|
|
||||||
{
|
|
||||||
if (_drawningAiroplane == null)
|
|
||||||
{
|
{
|
||||||
return;
|
InitializeComponent();
|
||||||
|
_strategy = null;
|
||||||
}
|
}
|
||||||
Bitmap bmp = new(pictureBoxAiroplane.Width, pictureBoxAiroplane.Height);
|
|
||||||
Graphics gr = Graphics.FromImage(bmp);
|
|
||||||
_drawningAiroplane.DrawTransport(gr);
|
|
||||||
pictureBoxAiroplane.Image = bmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
private void Draw()
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Перемещение объекта по форме (нажатие кнопок навигации)
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
|
|
||||||
private void buttonMove_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_drawningAiroplane == null)
|
|
||||||
{
|
{
|
||||||
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;
|
private void CreateObject(string type)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
|
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();
|
Draw();
|
||||||
}
|
}
|
||||||
}
|
/// <summary>
|
||||||
|
/// Кнопка создания самолета
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonCreate_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
CreateObject(nameof(DrawningAiroplane));
|
||||||
|
}
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// Кнопка создания самолета с радаром "Создать самолет с радаром"
|
||||||
|
///// </summary>
|
||||||
|
///// <param name="sender"></param>
|
||||||
|
///// <param name="e"></param>
|
||||||
|
//private void ButtonCreateAiroplane_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningAiroplane));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Кнопка создания самолета "Создать"
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
|
||||||
|
private void ButtonCreateplane_Click(object sender, EventArgs e) => CreateObject(nameof(Drawningplane));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение объекта по форме (нажатие кнопок навигации)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,121 @@
|
|||||||
|
namespace ProjectAiroplane.MovementStrategy;
|
||||||
|
|
||||||
|
public abstract class AbstractStrategy
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещаемый объект
|
||||||
|
/// </summary>
|
||||||
|
private IMoveableObjects? _moveableObject;
|
||||||
|
/// <summary>
|
||||||
|
/// Статус перемещения
|
||||||
|
/// </summary>
|
||||||
|
private StrategyStatus _state = StrategyStatus.NotInit;
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина поля
|
||||||
|
/// </summary>
|
||||||
|
protected int FieldWidth { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Высота поля
|
||||||
|
/// </summary>
|
||||||
|
protected int FieldHeight { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Статус перемещения
|
||||||
|
/// </summary>
|
||||||
|
public StrategyStatus GetStatus { get { return _state; } }
|
||||||
|
/// <summary>
|
||||||
|
/// Установка данных
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="moveableObjects"></param>
|
||||||
|
/// <param name="width"></param>
|
||||||
|
/// <param name="height"></param>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Шаг перемещения
|
||||||
|
/// </summary>
|
||||||
|
public void MakeStep()
|
||||||
|
{
|
||||||
|
if (_state != StrategyStatus.InProgress) return;
|
||||||
|
if (IsTargetDestinaion())//вызов абстрактного метода
|
||||||
|
{
|
||||||
|
_state = StrategyStatus.Finish;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MoveToTarget();// место вызова абстрактного метода
|
||||||
|
}
|
||||||
|
|
||||||
|
//public void Method()//
|
||||||
|
//{
|
||||||
|
// AbstrMethod();
|
||||||
|
//}
|
||||||
|
|
||||||
|
protected abstract void AbstrMethod();
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение влево
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Результат перемещения (true - удалось переместиться, false -неудача)</returns>
|
||||||
|
protected bool MoveLeft() => MoveTo(MovementDirection.Left);
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение вправо
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Результат перемещения (true - удалось переместиться, false -неудача)</returns>
|
||||||
|
protected bool MoveRight() => MoveTo(MovementDirection.Right);
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение вверх
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Результат перемещения (true - удалось переместиться, false -неудача)</returns>
|
||||||
|
protected bool MoveUp() => MoveTo(MovementDirection.Up);
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение вниз
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Результат перемещения (true - удалось переместиться, false -неудача)</returns>
|
||||||
|
protected bool MoveDown() => MoveTo(MovementDirection.Down);
|
||||||
|
/// <summary>
|
||||||
|
/// Параметры объекта
|
||||||
|
/// </summary>
|
||||||
|
protected ObjectParameters? GetObjectParameters => _moveableObject?.GetObjectPosition;
|
||||||
|
/// <summary>
|
||||||
|
/// Шаг объекта
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected int? GetStep()
|
||||||
|
{
|
||||||
|
if (_state != StrategyStatus.InProgress)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return _moveableObject?.GetStep;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение к цели
|
||||||
|
/// </summary>
|
||||||
|
protected abstract void MoveToTarget();//Абстрактный метод
|
||||||
|
/// <summary>
|
||||||
|
/// Достигнута ли цель
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected abstract bool IsTargetDestinaion();//Абстрактный метод
|
||||||
|
/// <summary>
|
||||||
|
/// Попытка перемещения в требуемом направлении
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="movementDirection">Направление</param>
|
||||||
|
/// <returns>Результат попытки (true - удалось переместиться, false -неудача)</returns>
|
||||||
|
private bool MoveTo(MovementDirection movementDirection)
|
||||||
|
{
|
||||||
|
if (_state != StrategyStatus.InProgress)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return _moveableObject?.TryMoveObject(movementDirection) ?? false;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
namespace ProjectAiroplane.MovementStrategy;
|
||||||
|
|
||||||
|
public interface IMoveableObjects
|
||||||
|
{
|
||||||
|
ObjectParameters? GetObjectPosition { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Шаг объекта
|
||||||
|
/// </summary>
|
||||||
|
int GetStep { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Попытка переместить объект в указанном направлении
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="direction"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
bool TryMoveObject(MovementDirection direction);
|
||||||
|
}
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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));
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Конвертация из MovementDirection в DirectionType
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="direction">MovementDirection</param>
|
||||||
|
/// <returns>DirectionType</returns>
|
||||||
|
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,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Вверх
|
||||||
|
/// </summary>
|
||||||
|
Up = 1,
|
||||||
|
/// <summary>
|
||||||
|
/// Вниз
|
||||||
|
/// </summary>
|
||||||
|
Down = 2,
|
||||||
|
/// <summary>
|
||||||
|
/// Влево
|
||||||
|
/// </summary>
|
||||||
|
Left = 3,
|
||||||
|
/// <summary>
|
||||||
|
/// Вправо
|
||||||
|
/// </summary>
|
||||||
|
Right = 4
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
namespace ProjectAiroplane.MovementStrategy;
|
||||||
|
|
||||||
|
|
||||||
|
public class ObjectParameters
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Координата х
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _x;
|
||||||
|
/// <summary>
|
||||||
|
/// Координата у
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _y;
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина объекта
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _width;
|
||||||
|
/// <summary>
|
||||||
|
/// Высота объекта
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _height;
|
||||||
|
/// <summary>
|
||||||
|
/// Левая граница
|
||||||
|
/// </summary>
|
||||||
|
public int LeftBorder => _x;
|
||||||
|
/// <summary>
|
||||||
|
/// Правая граница
|
||||||
|
/// </summary>
|
||||||
|
public int TopBorder => _y;
|
||||||
|
/// <summary>
|
||||||
|
/// Правая граница
|
||||||
|
/// </summary>
|
||||||
|
public int RightBorder => _x + _width;
|
||||||
|
/// <summary>
|
||||||
|
/// Нижняя граница
|
||||||
|
/// </summary>
|
||||||
|
public int DownBorder => _y + _height;
|
||||||
|
/// <summary>
|
||||||
|
/// Середина объекта
|
||||||
|
/// </summary>
|
||||||
|
public int ObjectMiddleHorizontal => _x + _width / 2;
|
||||||
|
/// <summary>
|
||||||
|
/// Середина объекта
|
||||||
|
/// </summary>
|
||||||
|
public int ObjectMiddleVertical => _y + _height / 2;
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x"></param>
|
||||||
|
/// <param name="y"></param>
|
||||||
|
/// <param name="width"></param>
|
||||||
|
/// <param name="height"></param>
|
||||||
|
public ObjectParameters(int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
_x = x;
|
||||||
|
_y = y;
|
||||||
|
_width = width;
|
||||||
|
_height = height;
|
||||||
|
}
|
||||||
|
}
|
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Все готово к началу
|
||||||
|
/// </summary>
|
||||||
|
NotInit,
|
||||||
|
/// <summary>
|
||||||
|
/// Выполняется
|
||||||
|
/// </summary>
|
||||||
|
InProgress,
|
||||||
|
// Завершена
|
||||||
|
Finish
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user