diff --git a/AirplaneWithRadar/ProjectAirplaneWithRadar/DrawingAirplaneWithRadar.cs b/AirplaneWithRadar/ProjectAirplaneWithRadar/DrawingAirplaneWithRadar.cs
index 59761f7..36f61b6 100644
--- a/AirplaneWithRadar/ProjectAirplaneWithRadar/DrawingAirplaneWithRadar.cs
+++ b/AirplaneWithRadar/ProjectAirplaneWithRadar/DrawingAirplaneWithRadar.cs
@@ -1,4 +1,4 @@
-namespace ProjectAirplaneWithRadar
+namespace ProjectAirplaneWithRadar.Entities
{
///
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
@@ -39,7 +39,7 @@
/// Высота прорисовки самолета
///
public readonly int PlaneHeight = 95;
-
+
///
/// Инициализация свойств
@@ -72,18 +72,18 @@
{
_pictureWidth = width;
_pictureHeight = height;
- if(_startPosX != null && _startPosY != null)
+ if (_startPosX != null && _startPosY != null)
{
- if(_startPosX.Value < 0)
+ if (_startPosX.Value < 0)
{
_startPosX = 0;
}
- if(_startPosY.Value < 0)
+ if (_startPosY.Value < 0)
{
_startPosY = 0;
}
- if(_startPosX.Value + PlaneWidth > _pictureWidth)
+ if (_startPosX.Value + PlaneWidth > _pictureWidth)
{
_startPosX = _pictureWidth - PlaneWidth;
}
@@ -116,7 +116,7 @@
{
_startPosX = 0;
}
- if(_startPosY.Value < 0)
+ if (_startPosY.Value < 0)
{
_startPosY = 0;
}
@@ -162,7 +162,7 @@
break;
// вправо
case DirectionType.Right:
- if (_startPosX.Value + step < _pictureWidth - PlaneWidth)
+ if (_startPosX.Value + step < _pictureWidth - PlaneWidth)
{
_startPosX += step;
}
@@ -227,8 +227,8 @@
}
//Корпус
- g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 50,100,30);
-
+ g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 50, 100, 30);
+
//Хвост
Point[] points = {
new Point(_startPosX.Value + 10, _startPosY.Value + 10),
@@ -259,7 +259,7 @@
//Хвостовой элерон
g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 45, 30, 10);
g.FillEllipse(brBlack, _startPosX.Value, _startPosY.Value + 45, 30, 10);
-
+
}
}
}
diff --git a/AirplaneWithRadar/ProjectAirplaneWithRadar/Entities/EntityAirplane.cs b/AirplaneWithRadar/ProjectAirplaneWithRadar/Entities/EntityAirplane.cs
new file mode 100644
index 0000000..868b609
--- /dev/null
+++ b/AirplaneWithRadar/ProjectAirplaneWithRadar/Entities/EntityAirplane.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 ProjectAirplaneWithRadar.Entities
+{
+ ///
+ /// Класс-сущность "Самолет"
+ ///
+ public class EntityAirplane
+ {
+ ///
+ /// Скорость
+ ///
+ 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 EntityAirplane(int speed, double weight, Color bodyColor)
+ {
+ Speed = speed;
+ Weight = weight;
+ BodyColor = bodyColor;
+ }
+ }
+}
\ No newline at end of file
diff --git a/AirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs b/AirplaneWithRadar/ProjectAirplaneWithRadar/Entities/EntityAirplaneWithRadar.cs
similarity index 56%
rename from AirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs
rename to AirplaneWithRadar/ProjectAirplaneWithRadar/Entities/EntityAirplaneWithRadar.cs
index 598eda9..269b5ed 100644
--- a/AirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs
+++ b/AirplaneWithRadar/ProjectAirplaneWithRadar/Entities/EntityAirplaneWithRadar.cs
@@ -1,25 +1,10 @@
-namespace ProjectAirplaneWithRadar
+namespace ProjectAirplaneWithRadar.Entities
{
///
/// Класс-сущность "Самолет с радаром"
///
- public class EntityAirplaneWithRadar
+ public class EntityAirplaneWithRadar : EntityAirplane
{
- ///
- /// Скорость
- ///
- public int Speed { get; private set; }
-
- ///
- /// Вес
- ///
- public double Weight { get; private set; }
-
- ///
- /// Основной цвет
- ///
- public Color BodyColor { get; private set; }
-
///
/// Дополнительный цвет (для опциональных элементов)
///
@@ -33,12 +18,7 @@
///
/// Признак (опция) наличия радар
///
- public bool Radar { get; private set; }
-
- ///
- /// Шаг перемещения автомобиля
- ///
- public double Step => Speed * 100 / Weight;
+ public bool Radar { get; private set; }
///
/// Инициализация полей объекта-класса самолета с радаром
@@ -49,14 +29,11 @@
/// Дополнительный цвет
/// Шасси
/// Радар
- public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool wheels, bool radar)
- {
- Speed = speed;
- Weight = weight;
- BodyColor = bodyColor;
+ public EntityAirplaneWithRadar(int speed, double weight, Color bodyColor, Color additionalColor, bool wheels, bool radar) : base(speed, weight, bodyColor)
+ {
AdditionalColor = additionalColor;
Wheels = wheels;
- Radar = radar;
+ Radar = radar;
}
}
}
diff --git a/AirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs b/AirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
index 7ec64fb..2b353ba 100644
--- a/AirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
+++ b/AirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
@@ -1,4 +1,6 @@
-namespace ProjectAirplaneWithRadar
+using ProjectAirplaneWithRadar.Entities;
+
+namespace ProjectAirplaneWithRadar
{
///
/// Форма работы с объектом "Самолет с радаром"