|
|
@@ -58,6 +58,7 @@ public class Terrain extends JPanel {
|
|
|
private Topbar topbar;
|
|
|
private Agenda agenda;
|
|
|
private WalkingPath currentpath;
|
|
|
+
|
|
|
|
|
|
private static TextPaint background;
|
|
|
private int festivalheight, festivalwidth, pathgenerate, maxvisitors;
|
|
|
@@ -69,6 +70,7 @@ public class Terrain extends JPanel {
|
|
|
transient Cursor rotate, pathpoint;
|
|
|
private Point lastMousePosition;
|
|
|
public enum Location{NORTH, EAST, SOUTH, WEST};
|
|
|
+ private static Location location;
|
|
|
|
|
|
public Terrain(int length, int width, SimulatorPane.Terrains terrain, Agenda agenda, SimulatorPane simulator){
|
|
|
//get values
|
|
|
@@ -225,7 +227,7 @@ public class Terrain extends JPanel {
|
|
|
if(dragObject != null){
|
|
|
if(SwingUtilities.isLeftMouseButton(e) && (dragObject instanceof AccessPoint || dragObject instanceof ExitPoint)){
|
|
|
if(clickPoint.getX()<200){
|
|
|
- dragObject.changeLocation(Location.WEST);
|
|
|
+ location = Location.SOUTH;
|
|
|
dragObject.setX(-75);
|
|
|
dragObject.setRotation(90);
|
|
|
if(dragObject.getY()<80){
|
|
|
@@ -237,7 +239,7 @@ public class Terrain extends JPanel {
|
|
|
}
|
|
|
} else if (clickPoint.getX()>200 && clickPoint.getX()< getFestivalWidth()-200){
|
|
|
if(clickPoint.getY()<(getFestivalHeight()/2)){
|
|
|
- dragObject.changeLocation(Location.NORTH);
|
|
|
+ location = Location.NORTH;
|
|
|
dragObject.setY(0);
|
|
|
dragObject.setRotation(180);
|
|
|
|
|
|
@@ -250,7 +252,7 @@ public class Terrain extends JPanel {
|
|
|
}
|
|
|
|
|
|
} else if(clickPoint.getY()>(getFestivalHeight()/2)){
|
|
|
- dragObject.changeLocation(Location.SOUTH);
|
|
|
+ location = Location.WEST;
|
|
|
dragObject.setY(getFestivalHeight()-75);
|
|
|
dragObject.setRotation(180);
|
|
|
|
|
|
@@ -263,7 +265,7 @@ public class Terrain extends JPanel {
|
|
|
}
|
|
|
}
|
|
|
} else if(clickPoint.getX()>getFestivalWidth()-200){
|
|
|
- dragObject.changeLocation(Location.EAST);
|
|
|
+ location = Location.EAST;
|
|
|
dragObject.setX(getFestivalWidth()-125);
|
|
|
dragObject.setRotation(90);
|
|
|
if(dragObject.getY()<80){
|
|
|
@@ -460,7 +462,15 @@ public class Terrain extends JPanel {
|
|
|
if(!entrances.isEmpty())
|
|
|
startpoint = entrances.get((int)(Math.random()*entrances.size())).getCenter();
|
|
|
if(startpoint != null) //No entrance found , stop adding people.
|
|
|
- visitors.add(new Visitor(new Point2D.Double(-100-Math.random()*200, getFestivalHeight()-Math.random()*getFestivalHeight()), startpoint, this));
|
|
|
+ if(location == Location.NORTH){
|
|
|
+ visitors.add(new Visitor(new Point2D.Double(getFestivalWidth()-Math.random()*getFestivalWidth(), -100-Math.random()*200), startpoint, this));
|
|
|
+ } else if(location == Location.EAST){
|
|
|
+ visitors.add(new Visitor(new Point2D.Double(getFestivalWidth()+Math.random()*200, getFestivalHeight()-Math.random()*getFestivalHeight()), startpoint, this));
|
|
|
+ } else if(location == Location.SOUTH){
|
|
|
+ visitors.add(new Visitor(new Point2D.Double(-100-Math.random()*200, getFestivalHeight()-Math.random()*getFestivalHeight()), startpoint, this));
|
|
|
+ } else if(location == Location.WEST){
|
|
|
+ visitors.add(new Visitor(new Point2D.Double(getFestivalWidth()-Math.random()*getFestivalWidth(), getFestivalHeight()+Math.random()*200), startpoint, this));
|
|
|
+ }
|
|
|
}
|
|
|
topbar.recalculate();
|
|
|
if(topbar.getTime().get(Calendar.HOUR_OF_DAY) > 20 && topbar.getTime().get(Calendar.HOUR_OF_DAY) < 25){
|