Added finish noise.

#story[1249]
This commit is contained in:
Kusal Ekanayake
2017-09-05 13:44:14 +12:00
parent 6ee2517f74
commit 396098e009
5 changed files with 24 additions and 10 deletions
@@ -3,6 +3,7 @@ package seng302.visualiser;
import java.io.IOException;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.Map;
import java.util.TimeZone;
import javafx.application.Platform;
@@ -54,6 +55,8 @@ public class GameClient {
private RaceState raceState = new RaceState();
private LobbyController lobbyController;
private ArrayList<ClientYacht> finishedBoats = new ArrayList<>();
private ObservableList<String> clientLobbyList = FXCollections.observableArrayList();
/**
@@ -160,6 +163,10 @@ public class GameClient {
// server.terminate();
// server = null;
// }
Sounds.stopSoundEffects();
Sounds.stopMusic();
Sounds.playMenuMusic();
FXMLLoader fxmlLoader = new FXMLLoader(
getClass().getResource("/views/StartScreenView.fxml"));
try {
@@ -348,6 +355,9 @@ public class GameClient {
for (ClientYacht yacht : allBoatsMap.values()) {
if (yacht.getBoatStatus() != BoatStatus.FINISHED.getCode()) {
raceFinished = false;
} else if (!finishedBoats.contains(yacht)) {
finishedBoats.add(yacht);
Sounds.playFinishSound();
}
}
@@ -363,6 +373,7 @@ public class GameClient {
}
if (raceFinished) {
Sounds.playFinishSound();
close();
loadFinishScreenView();
}