|
@@ -17,7 +17,6 @@ import java.awt.Point;
|
|
|
import java.awt.Rectangle;
|
|
import java.awt.Rectangle;
|
|
|
import java.awt.RenderingHints;
|
|
import java.awt.RenderingHints;
|
|
|
import java.awt.Shape;
|
|
import java.awt.Shape;
|
|
|
-import java.awt.TexturePaint;
|
|
|
|
|
import java.awt.Toolkit;
|
|
import java.awt.Toolkit;
|
|
|
import java.awt.event.MouseAdapter;
|
|
import java.awt.event.MouseAdapter;
|
|
|
import java.awt.event.MouseEvent;
|
|
import java.awt.event.MouseEvent;
|
|
@@ -30,6 +29,8 @@ import java.awt.geom.NoninvertibleTransformException;
|
|
|
import java.awt.geom.Point2D;
|
|
import java.awt.geom.Point2D;
|
|
|
import java.awt.geom.Rectangle2D;
|
|
import java.awt.geom.Rectangle2D;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
|
+import java.util.ConcurrentModificationException;
|
|
|
|
|
+import java.util.Iterator;
|
|
|
import java.util.LinkedList;
|
|
import java.util.LinkedList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
@@ -41,36 +42,31 @@ import agenda.Act;
|
|
|
import agenda.Agenda;
|
|
import agenda.Agenda;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+@SuppressWarnings("serial")
|
|
|
public class Terrain extends JPanel {
|
|
public class Terrain extends JPanel {
|
|
|
|
|
|
|
|
private List<DrawEngine> entities;
|
|
private List<DrawEngine> entities;
|
|
|
- private Point2D oldPosition;
|
|
|
|
|
|
|
+ private ArrayList<Visitor> visitors;
|
|
|
|
|
+ private WalkingPathArrayList paths;
|
|
|
|
|
+
|
|
|
|
|
+ private Point2D oldPosition, lastClickPosition,lastMovedMousePosition ;
|
|
|
private double oldRotation, oldScale;
|
|
private double oldRotation, oldScale;
|
|
|
private DrawEngine dragObject, selectedObject;
|
|
private DrawEngine dragObject, selectedObject;
|
|
|
- private static TextPaint background;
|
|
|
|
|
|
|
+
|
|
|
private Sidebar sidebar;
|
|
private Sidebar sidebar;
|
|
|
private Topbar topbar;
|
|
private Topbar topbar;
|
|
|
|
|
+ private Agenda agenda;
|
|
|
|
|
+ private WalkingPath currentpath;
|
|
|
|
|
|
|
|
- private int festivalheight, festivalwidth;
|
|
|
|
|
|
|
+ private static TextPaint background;
|
|
|
|
|
+ private int festivalheight, festivalwidth, pathgenerate, maxvisitors;
|
|
|
private int sideBarWidth = 200;
|
|
private int sideBarWidth = 200;
|
|
|
|
|
|
|
|
- private int pathgenerate, maxvisitors;
|
|
|
|
|
- private WalkingPath currentpath;
|
|
|
|
|
-
|
|
|
|
|
Point2D cameraPoint = new Point2D.Double(festivalwidth/2,festivalheight/2);
|
|
Point2D cameraPoint = new Point2D.Double(festivalwidth/2,festivalheight/2);
|
|
|
float cameraScale = 1;
|
|
float cameraScale = 1;
|
|
|
- private boolean grid;
|
|
|
|
|
- private ArrayList<Visitor> visitors;
|
|
|
|
|
- private WalkingPathArrayList paths;
|
|
|
|
|
|
|
+ private boolean grid, lastplayedact;
|
|
|
transient Cursor rotate, pathpoint;
|
|
transient Cursor rotate, pathpoint;
|
|
|
-
|
|
|
|
|
- Point2D lastClickPosition;
|
|
|
|
|
- Point lastMousePosition;
|
|
|
|
|
- Point2D lastMovedMousePosition;
|
|
|
|
|
- TexturePaint p;
|
|
|
|
|
-
|
|
|
|
|
- private Agenda agenda;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ private Point lastMousePosition;
|
|
|
public enum Location{NORTH, EAST, SOUTH, WEST};
|
|
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){
|
|
@@ -98,10 +94,13 @@ public class Terrain extends JPanel {
|
|
|
case URBAN:
|
|
case URBAN:
|
|
|
background = Images.TextPaint.TPTerrainStreet;
|
|
background = Images.TextPaint.TPTerrainStreet;
|
|
|
break;
|
|
break;
|
|
|
|
|
+ case UNDEFINED:
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- this.entities = new LinkedList();
|
|
|
|
|
- this.initEntities();
|
|
|
|
|
|
|
+ this.entities = new LinkedList<DrawEngine>();
|
|
|
this.listeners();
|
|
this.listeners();
|
|
|
this.agenda = agenda;
|
|
this.agenda = agenda;
|
|
|
}
|
|
}
|
|
@@ -140,16 +139,12 @@ public class Terrain extends JPanel {
|
|
|
|
|
|
|
|
//double click
|
|
//double click
|
|
|
if(e.getClickCount() == 2){
|
|
if(e.getClickCount() == 2){
|
|
|
- //TODO open dialog
|
|
|
|
|
JDialog dialog = new StageDialog(drawObject, agenda);
|
|
JDialog dialog = new StageDialog(drawObject, agenda);
|
|
|
-
|
|
|
|
|
//position
|
|
//position
|
|
|
Toolkit toolkit = Toolkit.getDefaultToolkit();
|
|
Toolkit toolkit = Toolkit.getDefaultToolkit();
|
|
|
Dimension screenSize = toolkit.getScreenSize();
|
|
Dimension screenSize = toolkit.getScreenSize();
|
|
|
-
|
|
|
|
|
int x = (int) ((screenSize.getWidth() - dialog.getWidth()) / 2);
|
|
int x = (int) ((screenSize.getWidth() - dialog.getWidth()) / 2);
|
|
|
int y = (int) ((screenSize.getHeight() - dialog.getHeight()) / 2);
|
|
int y = (int) ((screenSize.getHeight() - dialog.getHeight()) / 2);
|
|
|
-
|
|
|
|
|
Point center = new Point(x, y);
|
|
Point center = new Point(x, y);
|
|
|
|
|
|
|
|
dialog.setLocation(center);
|
|
dialog.setLocation(center);
|
|
@@ -228,7 +223,7 @@ public class Terrain extends JPanel {
|
|
|
Point2D clickPoint = getClickPoint(e.getPoint());
|
|
Point2D clickPoint = getClickPoint(e.getPoint());
|
|
|
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(clickPoint.getX()<200){
|
|
|
dragObject.changeLocation(Location.WEST);
|
|
dragObject.changeLocation(Location.WEST);
|
|
|
dragObject.setX(-75);
|
|
dragObject.setX(-75);
|
|
|
dragObject.setRotation(90);
|
|
dragObject.setRotation(90);
|
|
@@ -239,8 +234,8 @@ public class Terrain extends JPanel {
|
|
|
} else {
|
|
} else {
|
|
|
dragObject.setY(dragObject.getY() - (lastClickPosition.getY() - clickPoint.getY()));
|
|
dragObject.setY(dragObject.getY() - (lastClickPosition.getY() - clickPoint.getY()));
|
|
|
}
|
|
}
|
|
|
- } else if (e.getX()>200 && e.getX()< getFestivalWidth()-200){
|
|
|
|
|
- if(e.getY()<(getFestivalHeight()/2)){
|
|
|
|
|
|
|
+ } else if (clickPoint.getX()>200 && clickPoint.getX()< getFestivalWidth()-200){
|
|
|
|
|
+ if(clickPoint.getY()<(getFestivalHeight()/2)){
|
|
|
dragObject.changeLocation(Location.NORTH);
|
|
dragObject.changeLocation(Location.NORTH);
|
|
|
dragObject.setY(0);
|
|
dragObject.setY(0);
|
|
|
dragObject.setRotation(180);
|
|
dragObject.setRotation(180);
|
|
@@ -253,7 +248,7 @@ public class Terrain extends JPanel {
|
|
|
dragObject.setX(dragObject.getX() - (lastClickPosition.getX() - clickPoint.getX()));
|
|
dragObject.setX(dragObject.getX() - (lastClickPosition.getX() - clickPoint.getX()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- } else if(e.getY()>(getFestivalHeight()/2)){
|
|
|
|
|
|
|
+ } else if(clickPoint.getY()>(getFestivalHeight()/2)){
|
|
|
dragObject.changeLocation(Location.SOUTH);
|
|
dragObject.changeLocation(Location.SOUTH);
|
|
|
dragObject.setY(getFestivalHeight()-75);
|
|
dragObject.setY(getFestivalHeight()-75);
|
|
|
dragObject.setRotation(180);
|
|
dragObject.setRotation(180);
|
|
@@ -266,7 +261,7 @@ public class Terrain extends JPanel {
|
|
|
dragObject.setX(dragObject.getX() - (lastClickPosition.getX() - clickPoint.getX()));
|
|
dragObject.setX(dragObject.getX() - (lastClickPosition.getX() - clickPoint.getX()));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- } else if(e.getX()>getFestivalWidth()-200){
|
|
|
|
|
|
|
+ } else if(clickPoint.getX()>getFestivalWidth()-200){
|
|
|
dragObject.changeLocation(Location.EAST);
|
|
dragObject.changeLocation(Location.EAST);
|
|
|
dragObject.setX(getFestivalWidth()-125);
|
|
dragObject.setX(getFestivalWidth()-125);
|
|
|
dragObject.setRotation(90);
|
|
dragObject.setRotation(90);
|
|
@@ -321,7 +316,6 @@ public class Terrain extends JPanel {
|
|
|
} else {
|
|
} else {
|
|
|
object.setScale(object.getScale() * 1 + (e.getPreciseWheelRotation()/10.0));
|
|
object.setScale(object.getScale() * 1 + (e.getPreciseWheelRotation()/10.0));
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
//intersect
|
|
//intersect
|
|
|
for(DrawEngine draw: entities){
|
|
for(DrawEngine draw: entities){
|
|
|
if(draw != object){
|
|
if(draw != object){
|
|
@@ -330,7 +324,6 @@ public class Terrain extends JPanel {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
repaint();
|
|
repaint();
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -342,13 +335,7 @@ public class Terrain extends JPanel {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /*
|
|
|
|
|
- * Add facilities on initializing
|
|
|
|
|
- */
|
|
|
|
|
- private void initEntities(){
|
|
|
|
|
- //this.entities.add(new Stage(300, 10, 0.5, 10));
|
|
|
|
|
- //this.entities.add(new Stage(400, 40, 2, 10));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
public void paintComponent(Graphics g) {
|
|
public void paintComponent(Graphics g) {
|
|
|
super.paintComponent(g);
|
|
super.paintComponent(g);
|
|
@@ -360,7 +347,7 @@ public class Terrain extends JPanel {
|
|
|
//draw simulation field
|
|
//draw simulation field
|
|
|
Area a1 = new Area(new Rectangle2D.Double(sideBarWidth, 0, getWidth()-sideBarWidth, getHeight()));
|
|
Area a1 = new Area(new Rectangle2D.Double(sideBarWidth, 0, getWidth()-sideBarWidth, getHeight()));
|
|
|
Area a2 = new Area(topbar.getBackground());
|
|
Area a2 = new Area(topbar.getBackground());
|
|
|
- a2.transform(new AffineTransform().getTranslateInstance(1, 1.2));
|
|
|
|
|
|
|
+ a2.transform(AffineTransform.getTranslateInstance(1, 1.2));
|
|
|
a1.subtract(a2);
|
|
a1.subtract(a2);
|
|
|
|
|
|
|
|
g2.setClip(a1);
|
|
g2.setClip(a1);
|
|
@@ -368,11 +355,9 @@ public class Terrain extends JPanel {
|
|
|
g2.translate(sideBarWidth,0);
|
|
g2.translate(sideBarWidth,0);
|
|
|
g2.setTransform(getCamera());
|
|
g2.setTransform(getCamera());
|
|
|
|
|
|
|
|
-
|
|
|
|
|
g2.setPaint(Images.getTextPaint(background));
|
|
g2.setPaint(Images.getTextPaint(background));
|
|
|
g2.fill(new Rectangle2D.Double(0,0,festivalwidth,festivalheight));
|
|
g2.fill(new Rectangle2D.Double(0,0,festivalwidth,festivalheight));
|
|
|
|
|
|
|
|
-
|
|
|
|
|
if(grid){
|
|
if(grid){
|
|
|
g2.setColor(new Color(160,160,160,120));
|
|
g2.setColor(new Color(160,160,160,120));
|
|
|
g2.setStroke(new BasicStroke(1));
|
|
g2.setStroke(new BasicStroke(1));
|
|
@@ -418,7 +403,7 @@ public class Terrain extends JPanel {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if(collide){
|
|
if(collide){
|
|
|
g2.setColor(new Color(254, 0, 0, 128));
|
|
g2.setColor(new Color(254, 0, 0, 128));
|
|
|
}else{
|
|
}else{
|
|
@@ -430,12 +415,6 @@ public class Terrain extends JPanel {
|
|
|
g2.setClip(null);
|
|
g2.setClip(null);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private Rectangle drawDragRectangle(DrawEngine shape){
|
|
|
|
|
- Rectangle rectangle = null;
|
|
|
|
|
- rectangle = new Rectangle((int) (shape.getX() - shape.getDistanceToOtherObjects()), (int) (shape.getY() - shape.getDistanceToOtherObjects()), (int) (shape.getWidth() * shape.getScale() + (2 * shape.getDistanceToOtherObjects())), (int) (shape.getHeight() * shape.getScale() + (2 * shape.getDistanceToOtherObjects())));
|
|
|
|
|
- return rectangle;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
private boolean intersection(DrawEngine d1, DrawEngine d2){
|
|
private boolean intersection(DrawEngine d1, DrawEngine d2){
|
|
|
Area area = new Area(d1.getAffineTransform().createTransformedShape(d1.getRect()));
|
|
Area area = new Area(d1.getAffineTransform().createTransformedShape(d1.getRect()));
|
|
|
Area area2 = new Area(d2.getAffineTransform().createTransformedShape(d2.getRect()));
|
|
Area area2 = new Area(d2.getAffineTransform().createTransformedShape(d2.getRect()));
|
|
@@ -455,64 +434,99 @@ public class Terrain extends JPanel {
|
|
|
|
|
|
|
|
private AffineTransform getCamera() {
|
|
private AffineTransform getCamera() {
|
|
|
AffineTransform tx = new AffineTransform();
|
|
AffineTransform tx = new AffineTransform();
|
|
|
- //start field in top left corner, next to sidebar
|
|
|
|
|
tx.translate(-cameraPoint.getX() + sideBarWidth, -cameraPoint.getY());
|
|
tx.translate(-cameraPoint.getX() + sideBarWidth, -cameraPoint.getY());
|
|
|
- //start field in middle of screen
|
|
|
|
|
- //tx.translate(-cameraPoint.getX() + getWidth()/2, -cameraPoint.getY() + getHeight()/2);
|
|
|
|
|
tx.scale(cameraScale, cameraScale);
|
|
tx.scale(cameraScale, cameraScale);
|
|
|
return tx;
|
|
return tx;
|
|
|
}
|
|
}
|
|
|
public void calculate(){
|
|
public void calculate(){
|
|
|
- for(Visitor v:visitors){
|
|
|
|
|
- v.update(visitors, entities,paths);
|
|
|
|
|
|
|
+ try{
|
|
|
|
|
+ Iterator<Visitor> i = visitors.iterator();
|
|
|
|
|
+ while(i.hasNext()){
|
|
|
|
|
+ i.next().update(visitors, entities,paths);
|
|
|
}
|
|
}
|
|
|
- if(Math.random()*500 <100){
|
|
|
|
|
|
|
+ }catch(ConcurrentModificationException e){
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ if(visitors.size() < maxvisitors && Math.random()*500 <100 && !lastplayedact){
|
|
|
Point2D startpoint = null;
|
|
Point2D startpoint = null;
|
|
|
|
|
+ List<AccessPoint> entrances = new ArrayList<AccessPoint>();
|
|
|
for(DrawEngine e:entities){
|
|
for(DrawEngine e:entities){
|
|
|
- List<AccessPoint> entrances = new ArrayList<AccessPoint>();
|
|
|
|
|
- if(e.type == Objects.ENTRANCE){
|
|
|
|
|
|
|
+ if(e.type == Objects.ENTRANCE)
|
|
|
entrances.add((AccessPoint)e);
|
|
entrances.add((AccessPoint)e);
|
|
|
- }
|
|
|
|
|
- if(!entrances.isEmpty())
|
|
|
|
|
- startpoint = entrances.get((int)(Math.random()*entrances.size())).getCenter();
|
|
|
|
|
}
|
|
}
|
|
|
- if(startpoint == null || visitors.size() >= maxvisitors) return; //No entrance found OR to many visitors, stop adding people.
|
|
|
|
|
- visitors.add(new Visitor(new Point2D.Double(-100-Math.random()*200, getFestivalHeight()-Math.random()*getFestivalHeight()), startpoint));
|
|
|
|
|
|
|
+ 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));
|
|
|
}
|
|
}
|
|
|
topbar.recalculate();
|
|
topbar.recalculate();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void checkPlayingActs(){
|
|
|
|
|
+ if(agenda.lastActTime().getEndTime().getTimeInMillis() <= topbar.getTime().getTimeInMillis())
|
|
|
|
|
+ lastplayedact = true;
|
|
|
stageloop:
|
|
stageloop:
|
|
|
- for(DrawEngine object:entities){
|
|
|
|
|
- if(object.type == SimulatorPane.Objects.STAGE){
|
|
|
|
|
- SimulatorStage stage = (SimulatorStage)object;
|
|
|
|
|
- for(Act act:agenda.getCurrentActs(topbar.getTime())){
|
|
|
|
|
- if(act.getStage() == stage.getStage()){
|
|
|
|
|
- stage.setPlayingact(act);
|
|
|
|
|
- continue stageloop;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ for(DrawEngine object:entities){
|
|
|
|
|
+ if(object.type == SimulatorPane.Objects.STAGE){
|
|
|
|
|
+ SimulatorStage stage = (SimulatorStage)object;
|
|
|
|
|
+ for(Act act:agenda.getCurrentActs(topbar.getTime())){
|
|
|
|
|
+ if(act.getStage() == stage.getStage()){
|
|
|
|
|
+ stage.setPlayingact(act);
|
|
|
|
|
+ continue stageloop;
|
|
|
}
|
|
}
|
|
|
- stage.setPlayingact(null);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ stage.setPlayingact(null);
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ public void newWalkingPath(Images.TextPaint texture){
|
|
|
|
|
+ if(pathgenerate == 0){
|
|
|
|
|
+ currentpath = new WalkingPath(texture);
|
|
|
|
|
+ pathgenerate = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ public void removeWalkingPaths(DrawEngine object){
|
|
|
|
|
+ for(WalkingPath p:paths.getWalkingPadObject(object)){
|
|
|
|
|
+ paths.remove(p);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void createCustomCursors(){
|
|
|
|
|
+ Toolkit toolkit = Toolkit.getDefaultToolkit();
|
|
|
|
|
+ ImageType image;
|
|
|
|
|
+
|
|
|
|
|
+ image = ImageType.RotateCursor;
|
|
|
|
|
+ rotate = toolkit.createCustomCursor(Images.getImage(image), new Point(14,14), "Rotate");
|
|
|
|
|
|
|
|
|
|
+ image = ImageType.PathCursor;
|
|
|
|
|
+ pathpoint = toolkit.createCustomCursor(Images.getImage(image), new Point(14,14), "Pathpoint");
|
|
|
|
|
+ }
|
|
|
|
|
+ public void clearVisitors(){
|
|
|
|
|
+ visitors.clear();
|
|
|
|
|
+ }
|
|
|
|
|
+ public void removeVisitor(Visitor v){
|
|
|
|
|
+ visitors.remove(v);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //getters and setters
|
|
|
|
|
+
|
|
|
public void setFestivalHeight(int height){
|
|
public void setFestivalHeight(int height){
|
|
|
this.festivalheight = height;
|
|
this.festivalheight = height;
|
|
|
}
|
|
}
|
|
|
- public void setFestivalWidth(int width){
|
|
|
|
|
- this.festivalwidth = width;
|
|
|
|
|
- }
|
|
|
|
|
public int getFestivalHeight(){
|
|
public int getFestivalHeight(){
|
|
|
return festivalheight;
|
|
return festivalheight;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public void setFestivalWidth(int width){
|
|
|
|
|
+ this.festivalwidth = width;
|
|
|
|
|
+ }
|
|
|
public int getFestivalWidth(){
|
|
public int getFestivalWidth(){
|
|
|
return festivalwidth;
|
|
return festivalwidth;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- //getters and setters for sidebar
|
|
|
|
|
|
|
+
|
|
|
public void setDragObject(DrawEngine dragObject){
|
|
public void setDragObject(DrawEngine dragObject){
|
|
|
this.dragObject = dragObject;
|
|
this.dragObject = dragObject;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
public DrawEngine getDragObject(){
|
|
public DrawEngine getDragObject(){
|
|
|
return dragObject;
|
|
return dragObject;
|
|
|
}
|
|
}
|
|
@@ -521,42 +535,20 @@ public class Terrain extends JPanel {
|
|
|
entities.add(dragObject);
|
|
entities.add(dragObject);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public void createCustomCursors(){
|
|
|
|
|
- Toolkit toolkit = Toolkit.getDefaultToolkit();
|
|
|
|
|
- ImageType image;
|
|
|
|
|
-
|
|
|
|
|
- image = ImageType.RotateCursor;
|
|
|
|
|
- rotate = toolkit.createCustomCursor(Images.getImage(image), new Point(14,14), "Rotate");
|
|
|
|
|
-
|
|
|
|
|
- image = ImageType.PathCursor;
|
|
|
|
|
- pathpoint = toolkit.createCustomCursor(Images.getImage(image), new Point(14,14), "Pathpoint");
|
|
|
|
|
- }
|
|
|
|
|
public void toggleGrid(){
|
|
public void toggleGrid(){
|
|
|
grid = !grid;
|
|
grid = !grid;
|
|
|
}
|
|
}
|
|
|
- public void newWalkingPath(Images.TextPaint texture){
|
|
|
|
|
- if(pathgenerate == 0){
|
|
|
|
|
- currentpath = new WalkingPath(texture);
|
|
|
|
|
- pathgenerate = 1;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
public List<DrawEngine> getEntities() {
|
|
public List<DrawEngine> getEntities() {
|
|
|
return entities;
|
|
return entities;
|
|
|
}
|
|
}
|
|
|
- public void clearVisitors(){
|
|
|
|
|
- visitors.clear();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
public void setMaxVisitors(int v){
|
|
public void setMaxVisitors(int v){
|
|
|
this.maxvisitors = v;
|
|
this.maxvisitors = v;
|
|
|
}
|
|
}
|
|
|
public int getMaxVisitors(){
|
|
public int getMaxVisitors(){
|
|
|
return maxvisitors;
|
|
return maxvisitors;
|
|
|
}
|
|
}
|
|
|
- public void removeWalkingPaths(DrawEngine object){
|
|
|
|
|
- for(WalkingPath p:paths.getWalkingPadObject(object)){
|
|
|
|
|
- paths.remove(p);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
public void setEntities(List<DrawEngine> entities) {
|
|
public void setEntities(List<DrawEngine> entities) {
|
|
|
this.entities = entities;
|
|
this.entities = entities;
|
|
@@ -565,9 +557,12 @@ public class Terrain extends JPanel {
|
|
|
public void setPaths(WalkingPathArrayList paths) {
|
|
public void setPaths(WalkingPathArrayList paths) {
|
|
|
this.paths = paths;
|
|
this.paths = paths;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
public WalkingPathArrayList getPaths() {
|
|
public WalkingPathArrayList getPaths() {
|
|
|
return paths;
|
|
return paths;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public boolean isLastplayedact() {
|
|
|
|
|
+ return lastplayedact;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|