|
@@ -67,6 +67,8 @@ public class Terrain extends JPanel {
|
|
|
TexturePaint p;
|
|
TexturePaint p;
|
|
|
|
|
|
|
|
private Agenda agenda;
|
|
private Agenda agenda;
|
|
|
|
|
+
|
|
|
|
|
+ public enum Location{NORTH, EAST, SOUTH, WEST};
|
|
|
|
|
|
|
|
public Terrain(int length, int width, SimulatorPane.Terrains terrain, Agenda agenda, SimulatorPane simulator){
|
|
public Terrain(int length, int width, SimulatorPane.Terrains terrain, Agenda agenda, SimulatorPane simulator){
|
|
|
//get values
|
|
//get values
|
|
@@ -225,7 +227,8 @@ public class Terrain extends JPanel {
|
|
|
if(dragObject != null){
|
|
if(dragObject != null){
|
|
|
if(SwingUtilities.isLeftMouseButton(e) && (dragObject instanceof AccessPoint || dragObject instanceof ExitPoint)){
|
|
if(SwingUtilities.isLeftMouseButton(e) && (dragObject instanceof AccessPoint || dragObject instanceof ExitPoint)){
|
|
|
if(e.getX()<200){
|
|
if(e.getX()<200){
|
|
|
- dragObject.setX(-25);
|
|
|
|
|
|
|
+ dragObject.changeLocation(Location.WEST);
|
|
|
|
|
+ dragObject.setX(-75);
|
|
|
dragObject.setRotation(90);
|
|
dragObject.setRotation(90);
|
|
|
if(dragObject.getY()<80){
|
|
if(dragObject.getY()<80){
|
|
|
dragObject.setY(80);
|
|
dragObject.setY(80);
|
|
@@ -236,7 +239,8 @@ public class Terrain extends JPanel {
|
|
|
}
|
|
}
|
|
|
} else if (e.getX()>200 && e.getX()< getFestivalWidth()-200){
|
|
} else if (e.getX()>200 && e.getX()< getFestivalWidth()-200){
|
|
|
if(e.getY()<(getFestivalHeight()/2)){
|
|
if(e.getY()<(getFestivalHeight()/2)){
|
|
|
- dragObject.setY(40);
|
|
|
|
|
|
|
+ dragObject.changeLocation(Location.NORTH);
|
|
|
|
|
+ dragObject.setY(0);
|
|
|
dragObject.setRotation(180);
|
|
dragObject.setRotation(180);
|
|
|
|
|
|
|
|
if(dragObject.getX()<100){
|
|
if(dragObject.getX()<100){
|
|
@@ -248,7 +252,8 @@ public class Terrain extends JPanel {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} else if(e.getY()>(getFestivalHeight()/2)){
|
|
} else if(e.getY()>(getFestivalHeight()/2)){
|
|
|
- dragObject.setY(getFestivalHeight()-100);
|
|
|
|
|
|
|
+ dragObject.changeLocation(Location.SOUTH);
|
|
|
|
|
+ dragObject.setY(getFestivalHeight()-75);
|
|
|
dragObject.setRotation(180);
|
|
dragObject.setRotation(180);
|
|
|
|
|
|
|
|
if(dragObject.getX()<100){
|
|
if(dragObject.getX()<100){
|
|
@@ -260,12 +265,14 @@ public class Terrain extends JPanel {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
} else if(e.getX()>getFestivalWidth()-200){
|
|
} else if(e.getX()>getFestivalWidth()-200){
|
|
|
- dragObject.setX(getFestivalWidth()-200);
|
|
|
|
|
|
|
+ dragObject.changeLocation(Location.EAST);
|
|
|
|
|
+ dragObject.setX(getFestivalWidth()-125);
|
|
|
dragObject.setRotation(90);
|
|
dragObject.setRotation(90);
|
|
|
if(dragObject.getY()<80){
|
|
if(dragObject.getY()<80){
|
|
|
dragObject.setY(80);
|
|
dragObject.setY(80);
|
|
|
- } else if(dragObject.getY()>getFestivalHeight()-150){
|
|
|
|
|
|
|
+ } else if(dragObject.getY()>getFestivalHeight()-200){
|
|
|
dragObject.setY(getFestivalHeight()-150);
|
|
dragObject.setY(getFestivalHeight()-150);
|
|
|
|
|
+ dragObject.setRotation(90);
|
|
|
} else {
|
|
} else {
|
|
|
dragObject.setY(dragObject.getY() - (lastClickPosition.getY() - clickPoint.getY()));
|
|
dragObject.setY(dragObject.getY() - (lastClickPosition.getY() - clickPoint.getY()));
|
|
|
}
|
|
}
|