| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package gui.simulator;
- public class ExitPoint extends Draw{
-
- private static String imageLocation = "/simulator/uitgang.png";
- private static String facilityName = "Uitgang";
- private Terrain terrain;
- public ExitPoint(Terrain terrain, int x, int y, double scale, double distance) {
- super(imageLocation, x, y, scale, distance);
- this.terrain = terrain;
- }
-
- public String getFacilityName(){
- return facilityName;
- }
-
- @Override
- public void setX(double x){
- double oldPosX = this.getX();
- double oldPosY = this.getY();
- if(x<0){
- this.setRotation(90);
- this.x = 0;
- } else if(x>9*terrain.getWidth()/10){
- this.x = 9*terrain.getWidth()/10;
- this.setRotation(90);
- } else if(x>0 && x<9*terrain.getWidth()/10 && this.y > 50 && this.y < terrain.getFestivalLength()-150){
- this.x = oldPosX;
- this.y = oldPosY;
- } else {
- this.x = x;
- }
- }
- @Override
- public void setY(double y){
- double oldPosY = this.getY();
- if(y<50){
- this.setRotation(0);
- this.y = 50;
- } else if(y>11*terrain.getFestivalLength()/12){
- this.setRotation(0);
- this.y = 11*terrain.getFestivalLength()/12;
- } else if(x>terrain.getWidth()/10 && x<9*terrain.getWidth()/10 && this.y > 50 && this.y < terrain.getFestivalLength()-150){
- this.y = oldPosY;
- } else {
- this.y = y;
- }
- }
- }
|