PIbd-23_Minhasapov_R.H._Exc.../DrawningTrackedVehicle.java

58 lines
2.4 KiB
Java
Raw Permalink Normal View History

import java.awt.*;
public class DrawningTrackedVehicle extends DrawningTracktor {
public DrawningTrackedVehicle(int speed, float weight, Color bodyColor, int countRollers, Color dopColor, boolean bucket, boolean supports){
super(speed, weight, bodyColor, countRollers, 130, 87);
Tracktor = new EntityTrackedVehicle(speed, weight, bodyColor, dopColor, bucket, supports);
}
@Override
public void DrawTransport(Graphics2D g){
if (!(Tracktor instanceof EntityTrackedVehicle trackedVehicle))
{
return;
}
Color pen;
Color dopBrush = trackedVehicle.getDopColor();
if (trackedVehicle.getBucket())
{
pen = trackedVehicle.getDopColor();
g.setStroke(new BasicStroke(5));
g.setColor(pen);
g.drawLine((int)_startPosX + 1, (int)_startPosY + 90, (int)_startPosX + 15, (int)_startPosY + 70);
g.drawLine((int)_startPosX + 15, (int)_startPosY + 72, (int)_startPosX + 15, (int)_startPosY + 50);
g.drawLine((int)_startPosX + 15, (int)_startPosY + 52, (int)_startPosX + 10, (int)_startPosY + 45);
g.drawLine((int)_startPosX + 15, (int)_startPosY + 60, (int)_startPosX + 40, (int)_startPosY + 50);
g.setStroke(new BasicStroke(1));
}
_startPosX += 20;
_startPosY += 5;
super.DrawTransport(g);
_startPosX -= 20;
_startPosY -= 5;
if (trackedVehicle.getSupports())
{
pen = Color.BLACK;
g.setColor(dopBrush);
g.fillRect((int)_startPosX + 100, (int)_startPosY + 50, 10, 42);
g.setColor(pen);
g.drawRect((int)_startPosX + 100, (int)_startPosY + 50, 10, 42);
g.setColor(dopBrush);
g.fillRect((int)_startPosX + 90, (int)_startPosY + 82, 30, 10);
g.setColor(pen);
g.drawRect((int)_startPosX + 90, (int)_startPosY + 82, 30, 10);
g.setColor(dopBrush);
g.fillRect((int)_startPosX + 45, (int)_startPosY + 50, 10, 42);
g.setColor(pen);
g.drawRect((int)_startPosX + 45, (int)_startPosY + 50, 10, 42);
g.setColor(dopBrush);
g.fillRect((int)_startPosX + 35, (int)_startPosY + 82, 30, 10);
g.setColor(pen);
g.drawRect((int)_startPosX + 35, (int)_startPosY + 82, 30, 10);
}
}
}