44 lines
2.2 KiB
Java
44 lines
2.2 KiB
Java
import java.awt.*;
|
|
|
|
public class DrawingAdvancedArtillery extends DrawingArtillery {
|
|
public DrawingAdvancedArtillery(int speed, float weight, Color bodyColor, int rollersCount, Color dopColor, boolean weapon, boolean salvoBattery) {
|
|
super(speed, weight, bodyColor, rollersCount, 80, 50);
|
|
artillery = new EntityAdvancedArtillery(speed, weight, bodyColor, dopColor, weapon, salvoBattery);
|
|
}
|
|
|
|
public DrawingAdvancedArtillery(EntityAdvancedArtillery entity, IDrawingRollers rollers) {
|
|
super(entity, rollers);
|
|
}
|
|
|
|
@Override
|
|
public void drawTransport(Graphics2D g) {
|
|
if (!(artillery instanceof EntityAdvancedArtillery advancedArtillery)) {
|
|
return;
|
|
}
|
|
|
|
g.setColor(advancedArtillery.getDopColor());
|
|
if (advancedArtillery.getWeapon()) {
|
|
g.setStroke(new BasicStroke(8));
|
|
g.drawLine((int) _startPosX + _artilleryWidth / 2, (int) _startPosY + _artilleryHeight / 10, (int) _startPosX + _artilleryWidth, (int) _startPosY);
|
|
}
|
|
g.setStroke(new BasicStroke(6));
|
|
if (advancedArtillery.getSalvoBattery()) {
|
|
g.drawLine((int) _startPosX + _artilleryWidth / 4, (int) _startPosY + _artilleryHeight / 4, (int) _startPosX + _artilleryWidth / 4 + _artilleryHeight / 4, (int) _startPosY - 5);
|
|
g.drawLine((int) _startPosX + _artilleryWidth / 4 - _artilleryHeight / 4, (int) _startPosY + _artilleryHeight / 4, (int) _startPosX + _artilleryWidth / 4, (int) _startPosY - 5);
|
|
g.drawLine((int) _startPosX + _artilleryWidth / 4 - _artilleryHeight / 2, (int) _startPosY + _artilleryHeight / 4, (int) _startPosX + _artilleryWidth / 4 - _artilleryHeight / 4, (int) _startPosY - 5);
|
|
}
|
|
super.drawTransport(g);
|
|
}
|
|
|
|
@Override
|
|
public void setColor(Color color) {
|
|
var art = (EntityAdvancedArtillery) artillery;
|
|
artillery = new EntityAdvancedArtillery(art.getSpeed(), art.getWeight(), color, art.getDopColor(), art.getWeapon(), art.getSalvoBattery());
|
|
}
|
|
|
|
public void setDopColor(Color color) {
|
|
var art = (EntityAdvancedArtillery) artillery;
|
|
artillery = new EntityAdvancedArtillery(art.getSpeed(), art.getWeight(), art.getBodyColor(), color, art.getWeapon(), art.getSalvoBattery());
|
|
}
|
|
}
|