40 lines
1.1 KiB
Java
40 lines
1.1 KiB
Java
package DoubleDeckerBus.MovementStrategy;
|
|
|
|
import DoubleDeckerBus.DrawningObjects.DrawningBus;
|
|
import DoubleDeckerBus.DirectionType;
|
|
|
|
public class DrawningObjectBus implements IMoveableObject {
|
|
private final DrawningBus _drawningBus;
|
|
|
|
public DrawningObjectBus(DrawningBus drawningBus){
|
|
_drawningBus = drawningBus;
|
|
}
|
|
|
|
public ObjectParameters GetObjectParameters(){
|
|
if (_drawningBus == null || _drawningBus.EntityBus() == null) {
|
|
return null;
|
|
}
|
|
return new ObjectParameters(_drawningBus.GetPosX(), _drawningBus.GetPosY(), _drawningBus.GetWidth(), _drawningBus.GetHeight());
|
|
}
|
|
|
|
public int GetStep(){
|
|
if (_drawningBus.EntityBus() == null) {
|
|
return 0;
|
|
}
|
|
return (int)_drawningBus.EntityBus().Step();
|
|
}
|
|
|
|
public boolean CheckCanMove(DirectionType direction){
|
|
if (_drawningBus == null) {
|
|
return false;
|
|
}
|
|
return _drawningBus.CanMove(direction);
|
|
}
|
|
|
|
public void MoveObject(DirectionType direction){
|
|
if (_drawningBus == null) {
|
|
return;
|
|
}
|
|
_drawningBus.MoveTransport(direction);
|
|
}
|
|
} |