PIbd-21_Eliseev_E.E._Airbus.../Project/src/DrawingAirbus.java

49 lines
1.5 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import java.awt.*;
public class DrawingAirbus extends DrawingPlane
{
//Инициализаци свойств
public DrawingAirbus(int speed, int weight, Color corpusColor, Color addColor, boolean addCompartment, boolean addEngine)
{
super(speed, weight, corpusColor, 70, 30);
Plane = new EntityAirbus(speed, weight, corpusColor, addColor, addCompartment, addEngine);
}
@Override
public void DrawTransport(Graphics g)
{
Graphics2D g2d = (Graphics2D) g;
EntityAirbus airbus;
if (!(GetPlane() instanceof EntityAirbus))
{
return;
}
airbus = (EntityAirbus) Plane;
_startPosX += 10;
_startPosY += 5;
super.DrawTransport(g);
_startPosX -= 10;
_startPosY -= 5;
//дополнительный пассажирский отсек
if (airbus.AddСompartment)
{
g2d.setPaint(airbus.AddColor);
g.fillRect((int)_startPosX + 30, (int)_startPosY + 12, 14, 3);
g2d.setPaint(Color.BLACK);
g.drawRect((int)_startPosX + 30, (int)_startPosY + 12, 14, 3);
}
//дополнительный двигатель
if (airbus.AddEngine)
{
g2d.setPaint(airbus.AddColor);
g.fillOval((int)_startPosX + 24, (int)_startPosY + 22, 10, 5);
g2d.setPaint(Color.BLACK);
g.drawOval((int)_startPosX + 24, (int)_startPosY + 22, 10, 5);
}
}
}