Добавление интерфейса и класса отрисовки объектов
This commit is contained in:
parent
107ff418db
commit
cdb5b9f8fe
40
src/main/java/DrawingObjectArmoredCar.java
Normal file
40
src/main/java/DrawingObjectArmoredCar.java
Normal file
@ -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<String, Float> GetCurrentPosition() {
|
||||
return armoredCar.GetCurrentPosition();
|
||||
}
|
||||
}
|
14
src/main/java/IDrawingObject.java
Normal file
14
src/main/java/IDrawingObject.java
Normal file
@ -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<String, Float> GetCurrentPosition();
|
||||
}
|
Loading…
Reference in New Issue
Block a user