Fixed race timer to display real race time, and made race time scalable.

#story[445]
This commit is contained in:
Haoming Yin
2017-03-30 16:12:01 +13:00
parent b252797e9b
commit 971a3920a3
5 changed files with 14 additions and 12 deletions
+4 -2
View File
@@ -88,7 +88,7 @@ public class Race {
int numberOfMarks = this.course.size();
for (int i = 0; i < numberOfMarks; i++) {
Double time = (1000 * totalDistance / boat.getVelocity());
Double time = (totalDistance / boat.getVelocity() / timeScale);
// If there are singleMarks after this event
if (i < numberOfMarks - 1) {
@@ -101,6 +101,8 @@ public class Race {
events.put(boat, new ArrayList<>(Arrays.asList(event)));
}
totalDistance += event.getDistanceBetweenMarks();
System.out.println(totalDistance);
System.out.println(boat.getVelocity());
}
// There are no more marks after this event
@@ -190,6 +192,6 @@ public class Race {
* Increment the race time by one second
*/
public void incrementRaceTime(){
this.raceTime ++;
this.raceTime += this.timeScale;
}
}