PIbd-23_Polevoy_S.V._SelfPr.../DrawingAdvancedArtillery.java
2022-10-25 16:53:45 +04:00

33 lines
1.7 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);
}
}