kaas
This commit is contained in:
+14
-2
@@ -73,7 +73,7 @@ public class Panel extends JPanel implements ActionListener
|
|||||||
Point lastMousePosition = new Point(0, 0);
|
Point lastMousePosition = new Point(0, 0);
|
||||||
Point2D selectionPosition = new Point(0, 0);
|
Point2D selectionPosition = new Point(0, 0);
|
||||||
Images images = new Images();
|
Images images = new Images();
|
||||||
javax.swing.Timer t;
|
Timer t;
|
||||||
|
|
||||||
SimpleDateFormat formatter;
|
SimpleDateFormat formatter;
|
||||||
GregorianCalendar date;
|
GregorianCalendar date;
|
||||||
@@ -211,6 +211,18 @@ public class Panel extends JPanel implements ActionListener
|
|||||||
{
|
{
|
||||||
waypoints.add(w);
|
waypoints.add(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Waypoint getWaypoint(int i)
|
||||||
|
{
|
||||||
|
for(Waypoint w : waypoints)
|
||||||
|
{
|
||||||
|
if(w.getSelf() == i)
|
||||||
|
{
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public ArrayList<Waypoint> getWaypoints()
|
public ArrayList<Waypoint> getWaypoints()
|
||||||
{
|
{
|
||||||
@@ -231,7 +243,7 @@ public class Panel extends JPanel implements ActionListener
|
|||||||
visitors.add(new Visitor("visitor",point, agenda, objects));
|
visitors.add(new Visitor("visitor",point, agenda, objects));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
JOptionPane.showMessageDialog(this, "You don't have a entrance");
|
JOptionPane.showMessageDialog(this, "You don't have an entrance");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-12
@@ -28,6 +28,7 @@ public class Visitor
|
|||||||
Agenda agenda;
|
Agenda agenda;
|
||||||
ArrayList<DrawObject> objects;
|
ArrayList<DrawObject> objects;
|
||||||
int target;
|
int target;
|
||||||
|
int finalTarget;
|
||||||
|
|
||||||
public Visitor(String filename, Point2D position, Agenda agenda, ArrayList<DrawObject> objects)
|
public Visitor(String filename, Point2D position, Agenda agenda, ArrayList<DrawObject> objects)
|
||||||
{
|
{
|
||||||
@@ -42,6 +43,7 @@ public class Visitor
|
|||||||
fillActions();
|
fillActions();
|
||||||
System.out.println(actions.size());
|
System.out.println(actions.size());
|
||||||
target = 0;
|
target = 0;
|
||||||
|
finalTarget = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Graphics2D g2)
|
public void draw(Graphics2D g2)
|
||||||
@@ -88,6 +90,11 @@ public class Visitor
|
|||||||
moveToTarget(target, objects, visitors, paths);
|
moveToTarget(target, objects, visitors, paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void move(DrawObject tar)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void moveToTarget(DrawObject target, ArrayList<DrawObject> objects, ArrayList<Visitor> visitors, ArrayList<Path> paths)
|
public void moveToTarget(DrawObject target, ArrayList<DrawObject> objects, ArrayList<Visitor> visitors, ArrayList<Path> paths)
|
||||||
{
|
{
|
||||||
Point2D tar = target.getPosition();
|
Point2D tar = target.getPosition();
|
||||||
@@ -217,18 +224,14 @@ public class Visitor
|
|||||||
int dify = (int) (target2.getY() - position.getY());
|
int dify = (int) (target2.getY() - position.getY());
|
||||||
int distance = (int) Math.sqrt((difx * difx) + (dify * dify));
|
int distance = (int) Math.sqrt((difx * difx) + (dify * dify));
|
||||||
|
|
||||||
System.out.println(rotation);
|
if (rotation > newRot && distance > 10)
|
||||||
System.out.println(newRot);
|
{
|
||||||
System.out.println("--------------");
|
rotation -= 0.15;
|
||||||
// if (rotation > newRot && distance > 10)
|
}
|
||||||
// {
|
else if (rotation < newRot && distance > 10)
|
||||||
// rotation -= 0.15;
|
{
|
||||||
// }
|
rotation += 0.15;
|
||||||
// else if (rotation < newRot && distance > 10)
|
}
|
||||||
// {
|
|
||||||
// rotation += 0.15;
|
|
||||||
// }
|
|
||||||
rotation = newRot;
|
|
||||||
|
|
||||||
Point2D oldPosition = position;
|
Point2D oldPosition = position;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user