59 lines
2.4 KiB
Java
59 lines
2.4 KiB
Java
package src.DrawningObjects;
|
|
import src.Entities.EntityAirplane;
|
|
import src.Entities.EntityAirplaneWithRadar;
|
|
import javax.swing.*;
|
|
import java.awt.*;
|
|
public class DrawningAirplaneWithRadar extends DrawningAirplane {
|
|
public DrawningAirplaneWithRadar(int speed, double weight, Color bodyColor, Color additionalColor,
|
|
boolean radar, boolean dopBak,int width,int height ){
|
|
super(speed,weight,bodyColor,width,height);
|
|
if(EntityAirplane!=null){
|
|
EntityAirplane = new EntityAirplaneWithRadar(speed, weight, bodyColor, additionalColor, radar,dopBak);
|
|
}
|
|
}
|
|
public void ChangeAddColor(Color col){
|
|
((EntityAirplaneWithRadar)EntityAirplane).AdditionalColor = col;
|
|
}
|
|
|
|
@Override
|
|
public void DrawAirplane(Graphics2D g2d){
|
|
if(!(EntityAirplane instanceof EntityAirplaneWithRadar)){
|
|
return;
|
|
}
|
|
super.DrawAirplane(g2d);
|
|
EntityAirplaneWithRadar _airplaneWithRadar =(EntityAirplaneWithRadar) EntityAirplane;
|
|
|
|
//дополнительный бак
|
|
if (_airplaneWithRadar.DopBak()) {
|
|
g2d.setColor(_airplaneWithRadar.AdditionalColor());
|
|
g2d.fillOval( _startPosX, _startPosY + 45, 40, 20);
|
|
g2d.setColor(Color.BLACK);
|
|
g2d.drawOval(_startPosX, _startPosY + 45, 40, 20);
|
|
}
|
|
//радар
|
|
if (_airplaneWithRadar.Radar())
|
|
{
|
|
g2d.setColor(Color.BLACK);
|
|
g2d.drawLine(_startPosX + 60, _startPosY + 25, _startPosX + 60, _startPosY + 15);
|
|
g2d.drawLine( _startPosX + 60, _startPosY + 15, _startPosX + 67, _startPosY + 11);
|
|
g2d.setColor(_airplaneWithRadar.AdditionalColor());
|
|
Point point7 = new Point(_startPosX + 60, _startPosY + 15);
|
|
Point point8 = new Point(_startPosX + 60, _startPosY + 5);
|
|
Point point9 = new Point(_startPosX + 70, _startPosY + 25);
|
|
int[] curvePoints3x =
|
|
{
|
|
_startPosX + 60,
|
|
_startPosX + 60,
|
|
_startPosX + 70,
|
|
};
|
|
int[] curvePoints3y =
|
|
{
|
|
_startPosY + 15,
|
|
_startPosY + 5,
|
|
_startPosY + 25,
|
|
};
|
|
g2d.fillPolygon(curvePoints3x, curvePoints3y,curvePoints3x.length);
|
|
}
|
|
}
|
|
}
|