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

44 lines
2.2 KiB
Java
Raw Normal View History

2022-10-08 15:13:24 +04:00
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);
}
2022-10-25 16:53:45 +04:00
public DrawingAdvancedArtillery(EntityAdvancedArtillery entity, IDrawingRollers rollers) {
super(entity, rollers);
}
2022-10-08 15:13:24 +04:00
@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());
}
2022-10-08 15:13:24 +04:00
}