package Drawnings; import DifferenceOfWheels.IOrnaments; 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); EntityTruck = new EntityDumpTruck(speed, weight, bodyColor, additionalColor, body, tent); SetOrnamentWheel(); _ornament.SetCount(random.nextInt(2, 5)); } public DrawningDumpTruck (EntityDumpTruck _dumpTruck, IOrnaments ornament){ super(_dumpTruck, ornament); } 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); } } }