PIbd-12_Karamushko_M.K._Air.../DrawingModernAircraft.java

84 lines
3.6 KiB
Java
Raw Normal View History

2022-11-10 16:44:45 +04:00
import java.awt.*;
public class DrawingModernAircraft extends DrawingAircraft
{
2022-11-15 18:20:34 +04:00
public DrawingModernAircraft(EntityAircraft airFighter, IDrawingEngines engines)
{
super(airFighter, engines);
}
2022-11-10 16:44:45 +04:00
public DrawingModernAircraft(int speed, float weight, Color bodyColor, Color dopColor, boolean dopWings, boolean rockets)
{
super(speed, weight, bodyColor, 195, 166);
AirFighter = new EntityModernAircraft(speed, weight, bodyColor, dopColor, dopWings, rockets);
}
@Override
public void DrawTransport(Graphics2D g)
{
if (!(AirFighter instanceof EntityModernAircraft))
{
return;
}
EntityModernAircraft modernAircraft = (EntityModernAircraft)AirFighter;
g.setPaint(modernAircraft.DopColor);
if (modernAircraft.DopWings)
{
Polygon topDopWing = new Polygon();
topDopWing.addPoint((int)_startPosX + 78, (int)_startPosY + 56);
topDopWing.addPoint((int)_startPosX + 75, (int)_startPosY + 70);
topDopWing.addPoint((int)_startPosX + 55, (int)_startPosY + 50);
topDopWing.addPoint((int)_startPosX + 60, (int)_startPosY + 45);
Polygon bottomDopWing = new Polygon();
bottomDopWing.addPoint((int)_startPosX + 78, (int)_startPosY + 110);
bottomDopWing.addPoint((int)_startPosX + 75, (int)_startPosY + 96);
bottomDopWing.addPoint((int)_startPosX + 55, (int)_startPosY + 116);
bottomDopWing.addPoint((int)_startPosX + 60, (int)_startPosY + 121);
g.fillPolygon(topDopWing);
g.fillPolygon(bottomDopWing);
}
if (modernAircraft.Rockets)
{
Polygon topRocket1 = new Polygon();
topRocket1.addPoint((int)_startPosX + 100, (int)_startPosY + 20);
topRocket1.addPoint((int)_startPosX + 100, (int)_startPosY + 30);
topRocket1.addPoint((int)_startPosX + 112, (int)_startPosY + 30);
topRocket1.addPoint((int)_startPosX + 120, (int)_startPosY + 25);
topRocket1.addPoint((int)_startPosX + 112, (int)_startPosY + 20);
Polygon topRocket2 = new Polygon();
topRocket2.addPoint((int)_startPosX + 100, (int)_startPosY + 35);
topRocket2.addPoint((int)_startPosX + 100, (int)_startPosY + 45);
topRocket2.addPoint((int)_startPosX + 112, (int)_startPosY + 45);
topRocket2.addPoint((int)_startPosX + 120, (int)_startPosY + 40);
topRocket2.addPoint((int)_startPosX + 112, (int)_startPosY + 35);
Polygon bottomRocket1 = new Polygon();
bottomRocket1.addPoint((int)_startPosX + 100, (int)_startPosY + 146);
bottomRocket1.addPoint((int)_startPosX + 100, (int)_startPosY + 136);
bottomRocket1.addPoint((int)_startPosX + 112, (int)_startPosY + 136);
bottomRocket1.addPoint((int)_startPosX + 120, (int)_startPosY + 141);
bottomRocket1.addPoint((int)_startPosX + 112, (int)_startPosY + 146);
Polygon bottomRocket2 = new Polygon();
bottomRocket2.addPoint((int)_startPosX + 100, (int)_startPosY + 131);
bottomRocket2.addPoint((int)_startPosX + 100, (int)_startPosY + 121);
bottomRocket2.addPoint((int)_startPosX + 112, (int)_startPosY + 121);
bottomRocket2.addPoint((int)_startPosX + 120, (int)_startPosY + 126);
bottomRocket2.addPoint((int)_startPosX + 112, (int)_startPosY + 131);
g.fillPolygon(topRocket1);
g.fillPolygon(topRocket2);
g.fillPolygon(bottomRocket1);
g.fillPolygon(bottomRocket2);
}
super.DrawTransport(g);
}
}