WOOOOOOOOOOOOOOOOOOOO

This commit is contained in:
Yorick
2015-04-08 20:31:18 +02:00
parent bdcc40f00f
commit 8167fec369
3 changed files with 44 additions and 28 deletions
+2 -2
View File
@@ -55,11 +55,11 @@ public class Event implements Serializable {
}
public int getStart(){
return (startHour * 100) + startMinute;
return (startHour * 60) + startMinute;
}
public int getStop(){
return (stopHour * 100) + stopMinute;
return (stopHour * 60) + stopMinute;
}
public int getStopHour(){
+1 -1
View File
@@ -148,7 +148,7 @@ public class Panel extends JPanel implements ActionListener
addMouseWheelListener(new MouseWheel(this));
addFocusListener(new WindowFocusListener(this));
t = new Timer(1000 / 100, this);
t = new Timer(1000 / 10, this);
}
public int getPanelInfoLength()
+41 -25
View File
@@ -362,30 +362,38 @@ public class Visitor
}
@SuppressWarnings("static-access")
public void fillActions() {
public void fillActions()
{
int startTime = 540;
int stopTime = 1260;
while (startTime < stopTime) {
while (startTime < stopTime)
{
int random = (int) Math.floor(Math.random() * 51);
if (random < 40) {
if (random < 40)
{
Point2D position = null;
DrawObject targetStage = null;
ArrayList<Event> posEvents = new ArrayList<Event>();
for (Event e : agenda.getEvents()) {
if (startTime >= e.getStart() && startTime < e.getStop()) {
for (Event e : agenda.getEvents())
{
if (startTime >= e.getStart() && startTime < e.getStop())
{
posEvents.add(e);
}
}
if (posEvents.size() != 0) {
if (posEvents.size() != 0)
{
int r = (int) Math.floor(Math.random() * posEvents.size());
Event evs = posEvents.get(r);
for (DrawObject d : objects) {
if (d.getFileName().equals("stage")) {
for (DrawObject d : objects)
{
if (d.getFileName().equals("stage"))
{
Stage s = (Stage) d;
if (s.getStage().getName()
.equals(evs.getStage().getName())) {
if (s.getStage().getName().equals(evs.getStage().getName()))
{
position = s.getPosition();
targetStage = d;
}
@@ -394,50 +402,58 @@ public class Visitor
}
int randomtime = (int) (40 + (Math.random() * (60 - 40)));
if (position != null) {
if (position != null)
{
Waypoint w = getClosestWaypoint(position);
actions.add(new Action(position, startTime, randomtime,
targetStage, w));
actions.add(new Action(position, startTime, randomtime, targetStage, w));
}
startTime = startTime + randomtime;
} else if (random >= 40 && random < 45) {
}
else if (random >= 40 && random < 45)
{
Point2D position = null;
DrawObject targetStage = null;
ArrayList<DrawObject> foodPlaces = new ArrayList<DrawObject>();
for (DrawObject d : objects) {
if (d.getFileName().equals("food")) {
for (DrawObject d : objects)
{
if (d.getFileName().equals("food"))
{
foodPlaces.add(d);
}
}
if (foodPlaces.size() != 0) {
if (foodPlaces.size() != 0)
{
int r = (int) Math.floor(Math.random() * foodPlaces.size());
position = foodPlaces.get(r).getPosition();
targetStage = foodPlaces.get(r);
Waypoint w = getClosestWaypoint(position);
actions.add(new Action(position, startTime, 35,
targetStage, w));
actions.add(new Action(position, startTime, 35, targetStage, w));
startTime = startTime + 20;
}
startTime = startTime + 35;
} else if (random > 45) {
}
else if (random > 45)
{
Point2D position = null;
DrawObject targetStage = null;
ArrayList<DrawObject> toilets = new ArrayList<DrawObject>();
for (DrawObject d : objects) {
if (d.getFileName().equals("wc")) {
for (DrawObject d : objects)
{
if (d.getFileName().equals("wc"))
{
toilets.add(d);
}
}
if (toilets.size() != 0) {
if (toilets.size() != 0)
{
int r = (int) Math.floor(Math.random() * toilets.size());
position = toilets.get(r).getPosition();
targetStage = toilets.get(r);
Waypoint w = getClosestWaypoint(position);
actions.add(new Action(position, startTime, 35,
targetStage, w));
actions.add(new Action(position, startTime, 35, targetStage, w));
startTime = startTime + 20;
}
startTime = startTime + 35;