diff --git a/WarmlyShip/WarmlyShip/DrawningShip.cs b/WarmlyShip/WarmlyShip/DrawningShip.cs
index 6fb6d1b..851afa4 100644
--- a/WarmlyShip/WarmlyShip/DrawningShip.cs
+++ b/WarmlyShip/WarmlyShip/DrawningShip.cs
@@ -184,5 +184,13 @@
_startPosY = _pictureHeight.Value - _shipHeight;
}
}
+ ///
+ /// Получение текущей позиции объекта
+ ///
+ ///
+ public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
+ {
+ return (_startPosX, _startPosY, _startPosX + _carWidth, _startPosY + _carHeight);
+ }
}
}
diff --git a/WarmlyShip/WarmlyShip/DrawningWarmlyShip.cs b/WarmlyShip/WarmlyShip/DrawningWarmlyShip.cs
index 3a10285..873a682 100644
--- a/WarmlyShip/WarmlyShip/DrawningWarmlyShip.cs
+++ b/WarmlyShip/WarmlyShip/DrawningWarmlyShip.cs
@@ -18,7 +18,7 @@ namespace WarmlyShip
/// Признак наличия труб
/// Признак наличия топливного отсека
public DrawningWarmlyShip(int speed, float weight, Color bodyColor, Color dopColor, bool pipes, bool fuelCompartment) :
- base(speed, weight, bodyColor, 175, 65)
+ base(speed, weight, bodyColor, 170, 95)
{
Ship = new EntityWarmlyShip(speed, weight, bodyColor, dopColor, pipes, fuelCompartment);
}
@@ -43,10 +43,8 @@ namespace WarmlyShip
}
- //_startPosX += 10;
_startPosY += 30;
base.DrawTransport(g);
- //_startPosX -= 10;
_startPosY -= 30;
if (warmlyShip.FuelCompartment)
diff --git a/WarmlyShip/WarmlyShip/DrwaningObjectShip.cs b/WarmlyShip/WarmlyShip/DrwaningObjectShip.cs
new file mode 100644
index 0000000..d27cfd9
--- /dev/null
+++ b/WarmlyShip/WarmlyShip/DrwaningObjectShip.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WarmlyShip
+{
+ internal class DrwaningObjectShip : IDrawningObject
+ {
+ private DrawningShip _ship = null;
+
+ public DrwaningObjectShip(DrawningShip ship)
+ {
+ _ship = ship;
+ }
+
+ public float Step => _ship?.Ship?.Step ?? 0;
+
+ public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
+ {
+ return _ship?.GetCurrentPosition() ?? default;
+ }
+
+ public void MoveObject(Direction direction)
+ {
+ _ship?.MoveTransport(direction);
+ }
+
+ public void SetObject(int x, int y, int width, int height)
+ {
+ _ship.SetPosition(x, y, width, height);
+ }
+
+ void IDrawningObject.DrawningObject(Graphics g)
+ {
+ _ship.DrawTransport(g);
+ }
+ }
+}
diff --git a/WarmlyShip/WarmlyShip/IDrawningObject.cs b/WarmlyShip/WarmlyShip/IDrawningObject.cs
new file mode 100644
index 0000000..86c4476
--- /dev/null
+++ b/WarmlyShip/WarmlyShip/IDrawningObject.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WarmlyShip
+{
+ internal interface IDrawningObject
+ {
+ ///
+ /// Шаг перемещения объекта
+ ///
+ public float Step { get; }
+ ///
+ /// Установка позиции объекта
+ ///
+ /// Координата X
+ /// Координата Y
+ /// Ширина полотна
+ /// Высота полотна
+ void SetObject(int x, int y, int width, int height);
+ ///
+ /// Изменение направления пермещения объекта
+ ///
+ /// Направление
+ ///
+ void MoveObject(Direction direction);
+ ///
+ /// Отрисовка объекта
+ ///
+ ///
+ void DrawningObject(Graphics g);
+ ///
+ /// Получение текущей позиции объекта
+ ///
+ ///
+ (float Left, float Right, float Top, float Bottom) GetCurrentPosition();
+ }
+}