2023-12-19 19:39:16 +04:00

96 lines
3.7 KiB
Java

package DrawningObjects;
import java.awt.*;
import Entities.*;
public class DrawningSecondMonorail extends DrawningMonorail{
public DrawningSecondMonorail(int wheelCount, int rollVar, int speed, double weight, Color bodyColor, Color
additionalColor, boolean monorails, boolean secondCabin, int width, int height){
super(wheelCount, rollVar, speed, weight, bodyColor, width, height, 110, 60);
if(secondCabin){
relWidth = 290;
}
if (getEntityMonorail() != null)
{
setEntityMonorail(new EntitySecondMonorail(wheelCount, speed,
weight, bodyColor, additionalColor, monorails, secondCabin));
}
}
@Override
public void DrawTransport(Graphics g){
super.DrawTransport(g);
if (!(getEntityMonorail() instanceof EntitySecondMonorail secondMonorail)) {
return;
}
//Магнитная рельса
if(secondMonorail.getMonorails())
{
g.drawRect(getPosX(), getPosY() + 50, 140, 10);
g.fillRect(getPosX(), getPosY() + 50, 140, 10);
g.setColor(Color.WHITE);
g.fillRect(getPosX() + 5, getPosY() + 53, 130, 5);
}
if (secondMonorail.getSecondCabin())
{
//низ
g.setColor(Color.BLACK);
g.drawRect(getPosX() + 162, getPosY() + 36, 40, 8);
g.drawRect(getPosX() + 222, getPosY() + 36, 40, 8);
g.drawOval(getPosX() + 143, getPosY() + 37, 30, 8);
g.drawOval(getPosX() + 250, getPosY() + 37, 29, 8);
g.setColor(Color.BLACK);
g.fillRect(getPosX() + 162, getPosY() + 36, 40, 8);
g.fillRect(getPosX() + 222, getPosY() + 36, 40, 8);
g.fillOval(getPosX() + 143, getPosY() + 37, 30, 8);
g.fillOval(getPosX() + 250, getPosY() + 37, 29, 8);
_drawingWheels.Draw(g, getPosX() + 140, getPosY());
if (secondMonorail.getMonorails())
{
g.setColor(Color.BLACK);
g.drawRect(getPosX() + 140, getPosY() + 50, 145, 10);
g.fillRect(getPosX() + 140, getPosY() + 50, 145, 10);
g.setColor(Color.WHITE);
g.fillRect(getPosX() + 135, getPosY() + 53, 145, 5);
}
//Кабина
g.setColor(Color.BLACK);
g.drawRect(getPosX() + 150, getPosY() + 20, 120, 16);
g.fillRect(getPosX() + 150, getPosY() + 20, 120, 16);
int[] xp2 = new int[]{getPosX() + 150,getPosX() + 270,getPosX() + 267,getPosX() + 150};
int[] yp2 = new int[] {getPosX() + 20, getPosY() + 20, getPosY() + 5, getPosY() + 6};
Polygon pol2 = new Polygon(xp2, yp2, yp2.length);
g.setColor(secondMonorail.getAdditionalColor());
g.fillPolygon(pol2);
g.setColor(Color.BLACK);
g.drawPolygon(pol2);
//дверь
g.setColor(Color.WHITE);
g.fillRect(getPosX() + 189, getPosY() + 9, 12, 22);
g.setColor(Color.BLACK);
g.drawRect(getPosX() + 189, getPosY() + 9, 12, 22);
//Окна и прочее
g.setColor(Color.CYAN);
g.drawRect(getPosX() + 160, getPosY() + 8, 10, 10);
g.drawRect(getPosX() + 175, getPosY() + 8, 10, 10);
g.drawRect(getPosX() + 257, getPosY() + 8, 10, 10);
g.setColor(Color.BLACK);
g.drawRect(getPosX() + 270, getPosY() + 10, 2, 22);
g.fillRect(getPosX() + 270, getPosY() + 10, 2, 22);
}
}
}