diff --git a/src/main/java/kvr/missilecruiser_hard/DirectionType.java b/src/main/java/kvr/missilecruiser_hard/DirectionType.java
new file mode 100644
index 0000000..472a7c6
--- /dev/null
+++ b/src/main/java/kvr/missilecruiser_hard/DirectionType.java
@@ -0,0 +1,8 @@
+package kvr.missilecruiser_hard;
+
+public enum DirectionType {
+ Up,
+ Down,
+ Left,
+ Right
+}
diff --git a/src/main/java/kvr/missilecruiser_hard/DrawingMissileCruiser.java b/src/main/java/kvr/missilecruiser_hard/DrawingMissileCruiser.java
new file mode 100644
index 0000000..945f9ac
--- /dev/null
+++ b/src/main/java/kvr/missilecruiser_hard/DrawingMissileCruiser.java
@@ -0,0 +1,195 @@
+package kvr.missilecruiser_hard;
+
+import javafx.scene.canvas.GraphicsContext;
+import javafx.scene.image.Image;
+import javafx.scene.paint.Color;
+
+public class DrawingMissileCruiser {
+ /// Класс-сущность
+ private EntityMissileCruiser entityMissileCruiser;
+
+ public EntityMissileCruiser getEntityMissileCruiser(){
+ return entityMissileCruiser;
+ }
+
+ /// Ширина окна
+ private int pictureWidth;
+
+ /// Высота окна
+ private int pictureHeight;
+
+ /// X координата прорисовки
+ private int posX;
+
+ /// Y координата прорисовки
+ private int posY;
+
+ /// Ширина прорисовки
+ private final int entityWidth = 150;
+
+ /// Высота прорисовки
+ private final int entityHeight = 35;
+
+ ///
+ /// Инициализация свойств
+ ///
+ /// @param speed Скорость
+ /// @param weight Вес крейсера
+ /// @param primaryColor Основной цвет
+ /// @param secondaryColor Дополнительный цвет
+ /// @param vls_sides Признак наличия боковых установок вертикального пуска
+ /// @param vls_center Признак наличия центральных установок вертикального пуска
+ /// @param helipad Признак наличия вертолётной площадки
+ public void Init(int speed, int weight, Color primaryColor, Color secondaryColor, boolean vls_sides, boolean vls_center, boolean helipad)
+ {
+ entityMissileCruiser = new EntityMissileCruiser();
+ entityMissileCruiser.Init(speed, weight, primaryColor, secondaryColor, vls_sides, vls_center, helipad);
+ pictureWidth = 0;
+ pictureHeight = 0;
+ posX = 0;
+ posY = 0;
+ }
+
+ ///
+ /// Установка границ поля
+ ///
+ /// @param width Ширина поля
+ /// @param height Высота поля
+ /// true - границы заданы, false - проверка не пройдена, нельзя разместить объект в этих размерах
+ public boolean SetPictureSize(int width, int height)
+ {
+ if (entityMissileCruiser == null || width <= 0 || height <= 0)
+ {
+ return false;
+ }
+
+ if (entityWidth < width && entityHeight < height)
+ {
+ pictureWidth = width;
+ pictureHeight = height;
+
+ posX = Math.clamp(posX, 0, pictureWidth - entityWidth);
+ posY = Math.clamp(posY, 0, pictureHeight - entityHeight);
+
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ ///
+ /// Установка позиции
+ ///
+ /// @param x Координата X
+ /// @param y Координата Y
+ public void SetPosition(int x, int y)
+ {
+ if (pictureWidth == 0 || pictureHeight == 0)
+ {
+ return;
+ }
+
+ posX = Math.clamp(x, 0, pictureWidth - entityWidth);
+ posY = Math.clamp(y, 0, pictureHeight - entityHeight);
+ }
+
+ ///
+ /// Перемещение объекта в заданную сторону
+ ///
+ /// @param direction Направление
+ /// @return true - перемещене выполнено, false - перемещение невозможно
+ public boolean MoveTransport(DirectionType direction)
+ {
+ if (entityMissileCruiser == null || pictureWidth <= 0 || pictureHeight <= 0)
+ {
+ return false;
+ }
+
+ int step = entityMissileCruiser.getStep();
+ switch (direction)
+ {
+ case DirectionType.Left:
+ if (posX - step >= 0)
+ {
+ posX -= step;
+ }
+ return true;
+ case DirectionType.Up:
+ if (posY - step >= 0)
+ {
+ posY -= step;
+ }
+ return true;
+ case DirectionType.Right:
+ if (posX + step < pictureWidth - entityWidth)
+ {
+ posX += step;
+ }
+ return true;
+ case DirectionType.Down:
+ if (posY + step < pictureHeight - entityHeight)
+ {
+ posY += step;
+ }
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ private final Image cruiserContourImg = new Image("images/cruiser_contour.png");
+ private final Image vlsSideImg = new Image("images/cruiser_vls_sides.png");
+ private final Image vlsCenterImg = new Image("images/cruiser_vls_center.png");
+ private final Image helipadImg = new Image("images/cruiser_helipad.png");
+
+ ///
+ /// Прорисовка объекта
+ ///
+ /// @param gc Объект GDI+
+ public void DrawTransport(GraphicsContext gc)
+ {
+ if (entityMissileCruiser == null)
+ {
+ return;
+ }
+
+ double[][] contourPolygon = new double[][] {
+ {posX + 11, posY},
+ {posX + 116, posY},
+ {posX + 149, posY + 17},
+ {posX + 116, posY + 34},
+ {posX + 10, posY + 34},
+ {posX, posY + 29},
+ {posX, posY + 5}
+ };
+
+ gc.clearRect(0, 0, pictureWidth, pictureHeight);
+
+ gc.setFill(entityMissileCruiser.getPrimaryColor());
+ gc.fillPolygon(contourPolygon[0], contourPolygon[1], contourPolygon.length);
+
+ if (entityMissileCruiser.getVLS_Sides())
+ {
+ gc.setFill(entityMissileCruiser.getSecondaryColor());
+ gc.fillRect(posX + 44, posY + 5, 24, 6);
+ gc.fillRect(posX + 44, posY + 23, 24, 6);
+ gc.drawImage(vlsSideImg, posX, posY, entityWidth, entityHeight);
+ }
+ if (entityMissileCruiser.getVLS_Center())
+ {
+ gc.setFill(entityMissileCruiser.getSecondaryColor());
+ gc.fillRect(posX + 44, posY + 14, 24, 6);
+ gc.drawImage(vlsCenterImg, posX, posY, entityWidth, entityHeight);
+ }
+ if (entityMissileCruiser.getHelipad())
+ {
+ gc.setFill(entityMissileCruiser.getSecondaryColor());
+ gc.fillOval(posX + 2, posY + 9, 16, 16);
+ gc.drawImage(helipadImg, posX, posY, entityWidth, entityHeight);
+ }
+
+ gc.drawImage(cruiserContourImg, posX, posY, entityWidth, entityHeight);
+ }
+}
diff --git a/src/main/java/kvr/missilecruiser_hard/EntityMissileCruiser.java b/src/main/java/kvr/missilecruiser_hard/EntityMissileCruiser.java
new file mode 100644
index 0000000..86692c3
--- /dev/null
+++ b/src/main/java/kvr/missilecruiser_hard/EntityMissileCruiser.java
@@ -0,0 +1,81 @@
+package kvr.missilecruiser_hard;
+
+import javafx.scene.paint.Color;
+
+public class EntityMissileCruiser {
+
+ /// Скорость
+ private int speed;
+
+ public int getSpeed(){
+ return speed;
+ }
+
+ /// Вес
+ private double weight;
+
+ public double getWeight(){
+ return weight;
+ }
+
+ /// Основной цвет
+ private Color primaryColor;
+
+ public Color getPrimaryColor(){
+ return primaryColor;
+ }
+
+ /// Дополнительный цвет (для опциональных элементов)
+ private Color secondaryColor;
+
+ public Color getSecondaryColor(){
+ return secondaryColor;
+ }
+
+ /// Боковые установки вертикального пуска
+ private boolean vls_sides;
+
+ public boolean getVLS_Sides(){
+ return vls_sides;
+ }
+
+ /// Центральные установки вертикального пуска
+ private boolean vls_center;
+
+ public boolean getVLS_Center() {
+ return vls_center;
+ }
+
+ /// Вертолётная площадка
+ private boolean helipad;
+
+ public boolean getHelipad(){
+ return helipad;
+ }
+
+ /// Шаг перемещения
+ public int getStep() {
+ return (int)(speed * 100 / weight);
+ }
+
+ /**
+ * Инициализация полей объекта-класса ракетного крейсера
+ * @param Speed Скорость
+ * @param Weight Вес крейсера
+ * @param PrimaryColor Основной цвет
+ * @param SecondaryColor Дополнительный цвет
+ * @param VLS_Sides Признак наличия боковых установок вертикального пуска
+ * @param VLS_Center Признак наличия центральных установок вертикального пуска
+ * @param Helipad Признак наличия вертолётной площадки
+ */
+ public void Init(int Speed, int Weight, Color PrimaryColor, Color SecondaryColor, boolean VLS_Sides, boolean VLS_Center, boolean Helipad)
+ {
+ speed = Speed;
+ weight = Weight;
+ primaryColor = PrimaryColor;
+ secondaryColor = SecondaryColor;
+ vls_sides = VLS_Sides;
+ vls_center = VLS_Center;
+ helipad = Helipad;
+ }
+}