Added test for race dnf in Race class.

-Unable to test animation timer.

#story[778]
This commit is contained in:
David Wu
2017-05-01 16:37:55 +12:00
parent cdcbb07dc6
commit 0bfc9a5a39
2 changed files with 229 additions and 186 deletions
+7 -1
View File
@@ -31,6 +31,8 @@ public class Race implements Runnable {
protected long totalTimeElapsed;
protected int scaleFactor;
protected int PRERACE_TIME = 12; //time in milliseconds to pause during pre-race
protected boolean countdownFinish = false;
protected boolean runRace = true;
private int lastFPS = 20;
private int raceId;
private int dnfChance = 0; //percentage chance a boat fails at each checkpoint
@@ -119,8 +121,11 @@ public class Race implements Runnable {
public void handle(long arg0) {
timeLeft = startTime - currentTime;
if (timeLeft <= 0) {
countdownFinish = true;
stop();
simulateRace();
if (runRace) {
simulateRace();
}
} else {
currentTimeInSeconds = (timeLeft * scaleFactor) / 1000;
minutes = currentTimeInSeconds / 60;
@@ -132,6 +137,7 @@ public class Race implements Runnable {
}
};
timer.start();
//countdownFinish = true;
}
/**