Compare commits

...

1 Commits

Author SHA1 Message Date
Haoming Yin 971a3920a3 Fixed race timer to display real race time, and made race time scalable.
#story[445]
2017-03-30 16:12:01 +13:00
5 changed files with 14 additions and 12 deletions
@@ -150,7 +150,7 @@ public class CanvasController {
*/
private void drawWake(GraphicsContext gc, double x, double y, double speed, Color color, double heading){
double angle = Math.toRadians(heading);
speed = speed * 10;
speed = speed * 2;
Point newP = new Point(0, speed);
newP.rotate(angle);
@@ -127,7 +127,7 @@ public class RaceViewController {
for (Event event : events) {
if (event.getIsFinishingEvent()) {
keyFrames.add(
new KeyFrame(Duration.seconds(event.getTime() / 60 / 60 / 5),
new KeyFrame(Duration.seconds(event.getTime()),
onFinished -> {race.setBoatFinished(boat); handleEvent(event);},
new KeyValue(x, event.getThisMark().getLatitude()),
new KeyValue(y, event.getThisMark().getLongitude())
@@ -135,7 +135,7 @@ public class RaceViewController {
);
} else {
keyFrames.add(
new KeyFrame(Duration.seconds(event.getTime() / 60 / 60 / 5),
new KeyFrame(Duration.seconds(event.getTime()),
onFinished ->{
handleEvent(event);
boat.setHeading(event.getBoatHeading());
+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;
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
<configurations>
<race-name>AC35</race-name>
<race-size>6</race-size>
<time-scale>1.0</time-scale>
<time-scale>10.0</time-scale>
<wind-direction>135</wind-direction>
</configurations>
+6 -6
View File
@@ -4,31 +4,31 @@
<team>
<name>Oracle Team USA</name>
<alias>USA</alias>
<velocity>1</velocity>
<velocity>12.9</velocity>
</team>
<team>
<name>Artemis Racing</name>
<alias>ART</alias>
<velocity>1.1</velocity>
<velocity>13.1</velocity>
</team>
<team>
<name>Emirates Team New Zealand</name>
<alias>NZL</alias>
<velocity>2</velocity>
<velocity>15.6</velocity>
</team>
<team>
<name>Land Rover BAR</name>
<alias>BAR</alias>
<velocity>1.3</velocity>
<velocity>13.3</velocity>
</team>
<team>
<name>SoftBank Team Japan</name>
<alias>JAP</alias>
<velocity>1.7</velocity>
<velocity>14.7</velocity>
</team>
<team>
<name>Groupama Team France</name>
<alias>FRC</alias>
<velocity>1.4</velocity>
<velocity>11.4</velocity>
</team>
</teams>