2022-12-06 17:23:28 +04:00
|
|
|
import java.awt.*;
|
|
|
|
|
|
|
|
public class DrawningObjectBattleship implements IDrawningObject {
|
|
|
|
|
|
|
|
private DrawningBattleship _battleship = null;
|
|
|
|
public DrawningObjectBattleship(DrawningBattleship battleship){
|
|
|
|
_battleship = battleship;
|
|
|
|
}
|
2022-12-22 22:27:39 +04:00
|
|
|
public DrawningBattleship GetDrawningBattleship() {
|
|
|
|
return _battleship;
|
|
|
|
}
|
|
|
|
|
2022-12-06 17:23:28 +04:00
|
|
|
@Override
|
|
|
|
public float getStep() {
|
|
|
|
if (_battleship.Battleship != null) {
|
|
|
|
return _battleship.Battleship.GetStep();
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void SetObject(int x, int y, int width, int height) {
|
|
|
|
if (_battleship != null) _battleship.SetPosition(x, y, width, height);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void MoveObject(Direction direction) {
|
|
|
|
if (_battleship!= null) _battleship.MoveTransport(direction);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void DrawningObject(Graphics g) {
|
|
|
|
if (_battleship != null) _battleship.DrawTransport((Graphics2D) g);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public float[] GetCurrentPosition() {
|
|
|
|
if (_battleship != null) {return _battleship.GetCurrentPosition();}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|