PIbd21.LyovushkinaA.A.Conta.../DrawingContainerShip.java

64 lines
2.8 KiB
Java
Raw Normal View History

2023-09-25 18:40:25 +04:00
import java.awt.*;
2023-10-07 21:42:37 +04:00
public class DrawingContainerShip extends DrawingShip{
@Override
public EntityContainerShip EntityContainerShip;
2023-09-25 18:40:25 +04:00
private DrawingDecks drawingDecks;
2023-10-07 21:42:37 +04:00
public DrawingContainerShip(int speed, double weight, Color bodyColor, Color
additionalColor, boolean crane, boolean containers,int deck, int width, int height)
{
super(speed, weight, bodyColor,width, height, 110, 65);
if (EntityShip != null)
2023-09-25 18:40:25 +04:00
{
2023-10-07 21:42:37 +04:00
EntityShip = new EntityContainerShip(speed, weight, bodyColor,
additionalColor, crane, containers, deck);
2023-09-25 18:40:25 +04:00
}
2023-10-07 21:42:37 +04:00
}
2023-09-25 18:40:25 +04:00
public void DrawShip(Graphics2D g)
{
2023-10-07 21:42:37 +04:00
if(EntityShip == null)
{
return;
}
if(!(EntityShip is EntityContainerShip)) {
return;
}
2023-09-25 18:40:25 +04:00
//контейнеры
if (EntityContainerShip.Conteiners)
{
2023-10-07 21:42:37 +04:00
g.setPaint((EntityShip as EntityContainerShip).AdditionalColor);
super(DrawShip(g));
2023-09-25 18:40:25 +04:00
g.fillRect(_startPosX + 50, _startPosY + 55, 35, 10);
g.fillRect(_startPosX + 85, _startPosY + 55, 20, 10);
g.fillRect(_startPosX + 105, _startPosY + 50, 15, 15);
g.fillRect(_startPosX + 50, _startPosY + 45, 15, 10);
g.fillRect(_startPosX + 65, _startPosY + 45, 55, 5);
g.fillRect(_startPosX + 65, _startPosY + 50, 40, 5);
g.setPaint(Color.BLACK);
g.drawRect(_startPosX + 50, _startPosY + 55, 35, 10);
g.drawRect(_startPosX + 85, _startPosY + 55, 20, 10);
g.drawRect(_startPosX + 105, _startPosY + 50, 15, 15);
g.drawRect(_startPosX + 50, _startPosY + 45, 15, 10);
g.drawRect(_startPosX + 65, _startPosY + 45, 55, 5);
g.drawRect(_startPosX + 65, _startPosY + 50, 40, 5);
}
//кран
if (EntityContainerShip.Crane)
{
g.setPaint(EntityContainerShip.AdditionalColor);
g.fillRect(_startPosX + 43, _startPosY+20, 5, 45);
g.fillRect(_startPosX + 47, _startPosY + 30, 20, 3);
g.setPaint(Color.BLACK);
g.drawRect(_startPosX + 43, _startPosY+20, 5, 45);
g.drawRect(_startPosX + 47, _startPosY + 30, 20, 3);
g.drawLine(_startPosX + 47, _startPosY+20, _startPosX + 67, _startPosY + 30);
g.drawLine(_startPosX + 67, _startPosY + 33, _startPosX + 67, _startPosY + 45);
}
drawingDecks.DrawDeck(_startPosX, _startPosY, g);
}
}