Changed some private fields to protected in DrawingArtillery. Added method getCurrentPosition
This commit is contained in:
parent
02566d7957
commit
0e85f72177
@ -1,14 +1,14 @@
|
||||
import java.awt.*;
|
||||
|
||||
public class DrawingArtillery {
|
||||
private EntityArtillery artillery;
|
||||
private DrawingRollers drawingRollers;
|
||||
private float _startPosX;
|
||||
private float _startPosY;
|
||||
protected EntityArtillery artillery;
|
||||
protected DrawingRollers drawingRollers;
|
||||
protected float _startPosX;
|
||||
protected float _startPosY;
|
||||
private Integer _pictureWidth = null;
|
||||
private Integer _pictureHeight = null;
|
||||
private final int _artilleryWidth = 80;
|
||||
private final int _artilleryHeight = 50;
|
||||
protected int _artilleryWidth = 80;
|
||||
protected int _artilleryHeight = 50;
|
||||
|
||||
public EntityArtillery getArtillery() {
|
||||
return artillery;
|
||||
@ -19,6 +19,12 @@ public class DrawingArtillery {
|
||||
drawingRollers = new DrawingRollers(rollersCount, bodyColor);
|
||||
}
|
||||
|
||||
protected DrawingArtillery(int speed, float weight, Color bodyColor, int rollersCount, int artilleryWidth, int artilleryHeight) {
|
||||
this(speed, weight, bodyColor, rollersCount);
|
||||
_artilleryWidth = artilleryWidth;
|
||||
_artilleryHeight = artilleryHeight;
|
||||
}
|
||||
|
||||
public void SetPosition(int x, int y, int width, int height) {
|
||||
if (x < 0 || x + _artilleryWidth >= width)
|
||||
{
|
||||
@ -80,7 +86,7 @@ public class DrawingArtillery {
|
||||
return;
|
||||
}
|
||||
g.setColor(artillery.getBodyColor() != null ? artillery.getBodyColor() : Color.BLACK);
|
||||
g.fillRect((int) (_startPosX + _artilleryWidth / 8 * 2), (int) _startPosY, _artilleryWidth / 8 * 4, _artilleryWidth / 5);
|
||||
g.fillRect((int) (_startPosX + _artilleryWidth / 8 * 2), (int) _startPosY, _artilleryWidth / 8 * 4, _artilleryHeight / 5);
|
||||
g.fillRect((int) _startPosX, (int) (_startPosY + _artilleryHeight / 5), _artilleryWidth, _artilleryHeight / 3);
|
||||
|
||||
|
||||
@ -108,4 +114,8 @@ public class DrawingArtillery {
|
||||
_startPosY = _pictureHeight - _artilleryHeight;
|
||||
}
|
||||
}
|
||||
|
||||
public float[] getCurrentPosition() {
|
||||
return new float[] { _startPosX, _startPosX + _artilleryWidth - 1, _startPosY, _startPosY + _artilleryHeight -1 };
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user