PIbd-23_Polevoy_S.V._SelfPr.../DrawingAdvancedArtillery.java

29 lines
1.6 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);
}
@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);
}
}