From cdb5b9f8fe1d0e32f26f7a17b20737118d9a186c Mon Sep 17 00:00:00 2001 From: prodigygirl Date: Sat, 22 Oct 2022 22:50:54 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B8=D0=BD=D1=82=D0=B5=D1=80=D1=84=D0=B5?= =?UTF-8?q?=D0=B9=D1=81=D0=B0=20=D0=B8=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81?= =?UTF-8?q?=D0=B0=20=D0=BE=D1=82=D1=80=D0=B8=D1=81=D0=BE=D0=B2=D0=BA=D0=B8?= =?UTF-8?q?=20=D0=BE=D0=B1=D1=8A=D0=B5=D0=BA=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/DrawingObjectArmoredCar.java | 40 ++++++++++++++++++++++ src/main/java/IDrawingObject.java | 14 ++++++++ 2 files changed, 54 insertions(+) create mode 100644 src/main/java/DrawingObjectArmoredCar.java create mode 100644 src/main/java/IDrawingObject.java diff --git a/src/main/java/DrawingObjectArmoredCar.java b/src/main/java/DrawingObjectArmoredCar.java new file mode 100644 index 0000000..6868e1e --- /dev/null +++ b/src/main/java/DrawingObjectArmoredCar.java @@ -0,0 +1,40 @@ +import java.awt.*; +import java.util.HashMap; + +public class DrawingObjectArmoredCar implements IDrawingObject{ + private DrawingArmoredCar armoredCar = null; + + public DrawingObjectArmoredCar(DrawingArmoredCar armoredCar) { + this.armoredCar = armoredCar; + } + + @Override + public float getStep() { + if (armoredCar != null) + return armoredCar.armoredCar.step; + return 0; + } + + @Override + public void SetObject(int x, int y, int width, int height) { + if (armoredCar != null) + armoredCar.SetPosition(x, y, width, height); + } + + @Override + public void MoveObject(Direction direction) { + if (armoredCar != null) + armoredCar.MoveTransport(direction); + } + + @Override + public void DrawingObject(Graphics2D g) { + if (armoredCar != null) + armoredCar.DrawTransport(g); + } + + @Override + public HashMap GetCurrentPosition() { + return armoredCar.GetCurrentPosition(); + } +} diff --git a/src/main/java/IDrawingObject.java b/src/main/java/IDrawingObject.java new file mode 100644 index 0000000..cf65865 --- /dev/null +++ b/src/main/java/IDrawingObject.java @@ -0,0 +1,14 @@ +import java.awt.*; +import java.util.HashMap; + +public interface IDrawingObject { + float getStep(); + + void SetObject(int x, int y, int width, int height); + + void MoveObject(Direction direction); + + void DrawingObject(Graphics2D g); + + HashMap GetCurrentPosition(); +}