Pibd-23_Zhelovanov_D.Y._Bat.../DrawningLinkor.java

42 lines
1.4 KiB
Java
Raw Normal View History

2022-12-06 17:23:28 +04:00
import java.awt.*;
public class DrawningLinkor extends DrawningBattleship {
public DrawningLinkor(int speed, float weight, Color bodyColor, Color dopColor, boolean turret, boolean missileBay) {
super(speed, weight, bodyColor, 120, 50);
Battleship = new EntityLinkor(speed, weight, bodyColor, dopColor, turret, missileBay);
}
@Override
public void DrawTransport(Graphics2D g) {
if(!(Battleship instanceof EntityLinkor linkor))
{
return;
}
super.DrawTransport(g);
EntityLinkor entityLinkor = (EntityLinkor) Battleship;
if (entityLinkor.turret)
{
//Brush dopBrushRed = new SolidBrush(Color.Red);
g.setColor(entityLinkor.dopColor);
g.fillOval((int)_startPosX + 15, (int)_startPosY, 20, 20);
g.fillOval((int) _startPosX + 15, (int)_startPosY + 30, 20, 20);
g.setColor(Color.BLACK);
g.fillRect((int)_startPosX + 20, (int)_startPosY+5, 23, 7);
g.fillRect((int)_startPosX + 20,(int) _startPosY + 37, 23, 7);
}
if (entityLinkor.missileBay)
{
g.setColor(Color.BLACK);
g.fillOval((int)_startPosX, (int)_startPosY + 15, 20, 20);
g.setColor(entityLinkor.dopColor);
g.fillOval((int)_startPosX+5,(int) _startPosY + 20, 10, 10);
}
}
}