Pibd-23_Zhelovanov_D.Y._Bat.../DrawningObjectBattleship.java

39 lines
1.0 KiB
Java
Raw Permalink Normal View History

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;
}
@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;
}
}