2022-10-08 18:08:44 +04:00
|
|
|
import java.awt.*;
|
|
|
|
|
|
|
|
public class DrawningObjectLocomotive implements IDrawningObject {
|
|
|
|
private DrawningLocomotive _locomotive = null;
|
2022-11-05 18:49:21 +04:00
|
|
|
public DrawningLocomotive GetDrawningLocomotive() {
|
|
|
|
return _locomotive;
|
|
|
|
}
|
2022-10-08 18:08:44 +04:00
|
|
|
|
|
|
|
public DrawningObjectLocomotive(DrawningLocomotive locomotive)
|
|
|
|
{
|
|
|
|
_locomotive = locomotive;
|
|
|
|
}
|
|
|
|
public float getStep() {
|
|
|
|
if (_locomotive.Locomotive != null) {
|
|
|
|
return _locomotive.Locomotive.Step();
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void DrawningObject(Graphics g)
|
|
|
|
{
|
|
|
|
if (_locomotive != null) _locomotive.DrawTransport((Graphics2D) g);
|
|
|
|
}
|
|
|
|
|
|
|
|
public float[] GetCurrentPosition()
|
|
|
|
{
|
|
|
|
if (_locomotive != null) {
|
|
|
|
return _locomotive.GetCurrentPosition();
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void MoveObject(Direction direction)
|
|
|
|
{
|
|
|
|
if (_locomotive != null) _locomotive.MoveTransport(direction);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void SetObject(int x, int y, int width, int height)
|
|
|
|
{
|
|
|
|
if (_locomotive != null) _locomotive.SetPosition(x, y, width, height);
|
|
|
|
}
|
2022-11-19 12:58:00 +04:00
|
|
|
|
|
|
|
public String getInfo(){
|
|
|
|
if (_locomotive == null) return null;
|
|
|
|
return _locomotive.getDataForSave();
|
|
|
|
}
|
2022-11-19 14:06:39 +04:00
|
|
|
|
|
|
|
public static IDrawningObject Create(String data) {
|
|
|
|
return new DrawningObjectLocomotive(DrawningLocomotive.createDrawningLocomotive(data));
|
|
|
|
}
|
2022-10-08 18:08:44 +04:00
|
|
|
}
|