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

43 lines
1.1 KiB
Java

import java.awt.*;
public class DrawningObjectBattleship implements IDrawningObject {
private DrawningBattleship _battleship = null;
public DrawningObjectBattleship(DrawningBattleship battleship){
_battleship = battleship;
}
public DrawningBattleship GetDrawningBattleship() {
return _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;
}
}