PIbd-14_Antonova_A.A.__Hard/Drawnings/DrawningDumpTruck.java

59 lines
1.7 KiB
Java
Raw Permalink Normal View History

2024-06-10 13:56:47 +04:00
package Drawnings;
import Entities.EntityDumpTruck;
import java.awt.*;
public class DrawningDumpTruck extends DrawningTruck{
public DrawningDumpTruck(int speed, double weight, Color bodyColor,
Color additionalColor, Boolean body, Boolean tent)
{
super(speed, weight, bodyColor);
//super(110, 100);
EntityTruck = new EntityDumpTruck(speed, weight, bodyColor, additionalColor, body, tent);
_ornament.SetCount(random.nextInt(2, 5));
}
public DrawningDumpTruck(){
super(110, 100);
}
public void DrawTransport(Graphics2D g)
{
if (EntityTruck == null || !(EntityTruck instanceof EntityDumpTruck entityTruck) || _startPosX == null || _startPosY == null)
{
return;
}
g.setPaint(Color.BLACK);
_startPosX += 5;
super.DrawTransport(g);
_startPosX -= 5;
if (entityTruck.Body)
{
int[] x_b = {_startPosX, _startPosX + 77, _startPosX + 77, _startPosX + 20};
int[] y_b = {_startPosY + 15, _startPosY + 15, _startPosY + 50, _startPosY + 50};
g.setPaint(Color.BLACK);
g.drawPolygon(x_b, y_b, 4);
g.setPaint(entityTruck.AdditionalColor);
g.fillPolygon(x_b, y_b, 4);
}
if (entityTruck.Tent && entityTruck.Body)
{
int[] x_t = {_startPosX, _startPosX + 39, _startPosX + 77};
int[] y_t = {_startPosY + 13, _startPosY, _startPosY + 13};
g.setPaint(Color.BLACK);
g.drawPolygon(x_t, y_t, 3);
g.setPaint(entityTruck.AdditionalColor);
g.fillPolygon(x_t, y_t, 3);
}
}
}