diff --git a/AntiAircraftGun/AntiAircraftGun/DrawingAntiAircraftGun.cs b/AntiAircraftGun/AntiAircraftGun/DrawingAntiAircraftGun.cs
index 71380eb..a1a9e67 100644
--- a/AntiAircraftGun/AntiAircraftGun/DrawingAntiAircraftGun.cs
+++ b/AntiAircraftGun/AntiAircraftGun/DrawingAntiAircraftGun.cs
@@ -185,5 +185,12 @@ namespace AntiAircraftGun
_startPosY = _pictureHeight.Value - _antiAircrafGunHeight;
}
}
+ ///
+ /// Получение текущей позиции объекта
+ ///
+ public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
+ {
+ return (_startPosX, _startPosY, _startPosX + _antiAircrafGunWidth, _startPosY + _antiAircrafGunHeight);
+ }
}
}
diff --git a/AntiAircraftGun/AntiAircraftGun/DrawingObjectAntiAircraftGun.cs b/AntiAircraftGun/AntiAircraftGun/DrawingObjectAntiAircraftGun.cs
new file mode 100644
index 0000000..6f82639
--- /dev/null
+++ b/AntiAircraftGun/AntiAircraftGun/DrawingObjectAntiAircraftGun.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AntiAircraftGun
+{
+ internal class DrawingObjectAntiAircraftGun : IDrawingObject
+ {
+ private DrawingAntiAircraftGun _antiAircraftGun = null;
+ public DrawingObjectAntiAircraftGun(DrawingAntiAircraftGun antiAircraftGun)
+ {
+ _antiAircraftGun = antiAircraftGun;
+ }
+ public float Step => _antiAircraftGun?.AntiAircraftGun?.Step ?? 0;
+ public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
+ {
+ return _antiAircraftGun?.GetCurrentPosition() ?? default;
+ }
+ public void MoveObject(Direction direction)
+ {
+ _antiAircraftGun?.MoveTransport(direction);
+ }
+ public void SetObject(int x, int y, int width, int height)
+ {
+ _antiAircraftGun.SetPosition(x, y, width, height);
+ }
+
+ void IDrawingObject.DrawingObjectAntiAircraftGun(Graphics g)
+ {
+ _antiAircraftGun?.DrawTransport(g);
+ }
+ }
+}
diff --git a/AntiAircraftGun/AntiAircraftGun/IDrawingObject.cs b/AntiAircraftGun/AntiAircraftGun/IDrawingObject.cs
new file mode 100644
index 0000000..ee0ad14
--- /dev/null
+++ b/AntiAircraftGun/AntiAircraftGun/IDrawingObject.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AntiAircraftGun
+{
+ ///
+ /// Интерфейс для работы с объектом, прорисовываемом на форме
+ ///
+ internal interface IDrawingObject
+ {
+ ///
+ /// Шаг перемещения объекта
+ ///
+ public float Step { get; }
+ ///
+ /// Установка позиции объекта
+ ///
+ /// Координата X
+ /// Координата Y
+ /// Ширина полотна
+ /// Высота полотна
+ void SetObject(int x, int y, int width, int height);
+ ///
+ /// Изменение направления пермещения объекта
+ ///
+ /// Направление
+ void MoveObject(Direction direction);
+ ///
+ /// Отрисовка объекта
+ ///
+ ///
+ void DrawingObjectAntiAircraftGun(Graphics g);
+ ///
+ /// Получение текущей позиции объекта
+ ///
+ ///
+ (float Left, float Right, float Top, float Bottom) GetCurrentPosition();
+ }
+}