PIbd-12_Karamushko_M.K._Air.../DrawingObjectAircraft.java
2022-12-02 10:17:40 +03:00

56 lines
1.4 KiB
Java

import java.awt.*;
public class DrawingObjectAircraft implements IDrawingObject
{
private DrawingAircraft _aircraft = null;
public DrawingObjectAircraft(DrawingAircraft aircraft){
_aircraft = aircraft;
}
public DrawingAircraft getAircraft() {
return _aircraft;
}
public void MoveObject(Direction direction) {
if(_aircraft == null) return;
_aircraft.MoveTransport(direction);
}
@Override
public float getStep() {
if(_aircraft == null) return 0;
return _aircraft.AirFighter.Step;
}
public void SetObject(int x, int y, int width, int height)
{
_aircraft.SetPosition(x, y, width, height);
}
public void DrawningObject(Graphics2D g)
{
// TODO
_aircraft.DrawTransport(g);
}
@Override
public Point GetLeftTop() {
if(_aircraft == null) return new Point(0,0);
return _aircraft.getLeftTop();
}
@Override
public Point GetRightBottom() {
if(_aircraft == null) return new Point(0,0);
return _aircraft.getRightBottom();
}
@Override
public String GetInfo() {
return AircraftFactory.getDataForSave(_aircraft);
}
public static DrawingObjectAircraft Create(String data) {
return new DrawingObjectAircraft(AircraftFactory.createAircraftFromData(data));
}
}