49 lines
1.7 KiB
Java
49 lines
1.7 KiB
Java
import java.awt.*;
|
|
|
|
public class DrawningCatamaran extends DrawningBoat{
|
|
|
|
public DrawningCatamaran(int speed, float weight, Color bodyColor, Color dopColor, boolean sail, boolean floats)
|
|
{
|
|
super(speed, weight, bodyColor, 140, 70);
|
|
Boat = new EntityCatamaran(speed, weight, bodyColor, dopColor, sail, floats);
|
|
}
|
|
|
|
protected DrawningCatamaran(EntityBoat boat, IDrawningOars oars){
|
|
super(boat,oars);
|
|
Boat = boat;
|
|
}
|
|
|
|
@Override
|
|
public void DrawTransport(Graphics g)
|
|
{
|
|
if (! (Boat instanceof EntityCatamaran Catamaran))
|
|
{
|
|
return;
|
|
}
|
|
super.paintComponent(g);
|
|
Graphics2D g2d = (Graphics2D) g;
|
|
g2d.setColor(Color.BLACK);
|
|
_startPosX += 10;
|
|
_startPosY += 5;
|
|
super.DrawTransport(g);
|
|
_startPosX -= 10;
|
|
_startPosY -= 5;
|
|
int _catamaranWidth = 80;
|
|
int _catamaranHeight = 50;
|
|
if (Catamaran.Sail)
|
|
{
|
|
g2d.setPaint(Catamaran.DopColor);
|
|
int[] p_x = {(int)(_startPosX + _catamaranWidth * 2 / 4), (int)(_startPosX + _catamaranWidth), (int)(_startPosX + _catamaranWidth * 2 / 4)};
|
|
int[] p_y = {(int)_startPosY + 5, (int)(_startPosY + _catamaranHeight / 2), (int)(_startPosY + _catamaranHeight)};
|
|
g.fillPolygon(p_x, p_y, 3);
|
|
}
|
|
if (Catamaran.Floats)
|
|
{
|
|
g2d.setPaint(Catamaran.DopColor);
|
|
g.fillOval(_startPosX, _startPosY, (int)(_catamaranWidth / 2), (int)(_catamaranHeight / 2));
|
|
g.fillOval(_startPosX, 27 + _startPosY + (int)(_catamaranHeight / 2), (int)(_catamaranWidth / 2), (int)(_catamaranHeight / 2));
|
|
}
|
|
|
|
}
|
|
}
|