mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Added finish noise.
#story[1249]
This commit is contained in:
@@ -366,7 +366,7 @@ public class GameState implements Runnable {
|
|||||||
Double velocity = yacht.getCurrentVelocity();
|
Double velocity = yacht.getCurrentVelocity();
|
||||||
Double trueWindAngle = Math.abs(windDirection - yacht.getHeading());
|
Double trueWindAngle = Math.abs(windDirection - yacht.getHeading());
|
||||||
Double boatSpeedInKnots = PolarTable.getBoatSpeed(getWindSpeedKnots(), trueWindAngle);
|
Double boatSpeedInKnots = PolarTable.getBoatSpeed(getWindSpeedKnots(), trueWindAngle);
|
||||||
Double maxBoatSpeed = GeoUtility.knotsToMMS(boatSpeedInKnots);
|
Double maxBoatSpeed = GeoUtility.knotsToMMS(boatSpeedInKnots) * 5;
|
||||||
// TODO: 15/08/17 remove magic numbers from these equations.
|
// TODO: 15/08/17 remove magic numbers from these equations.
|
||||||
if (yacht.getSailIn()) {
|
if (yacht.getSailIn()) {
|
||||||
if (velocity < maxBoatSpeed - 500) {
|
if (velocity < maxBoatSpeed - 500) {
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ public class Sounds {
|
|||||||
musicPlayer.stop();
|
musicPlayer.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void stopSoundEffects() {
|
||||||
|
soundEffect.stop();
|
||||||
|
}
|
||||||
|
|
||||||
public static void toggleMuteMusic() {
|
public static void toggleMuteMusic() {
|
||||||
musicMuted = !musicMuted;
|
musicMuted = !musicMuted;
|
||||||
musicPlayer.setMute(musicMuted);
|
musicPlayer.setMute(musicMuted);
|
||||||
@@ -75,6 +79,13 @@ public class Sounds {
|
|||||||
soundPlayer.setMute(soundEffectsMuted);
|
soundPlayer.setMute(soundEffectsMuted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void playFinishSound() {
|
||||||
|
Media finishSound = new Media(Sounds.class.getClassLoader().getResource("sounds/Sms-notification.mp3").toString());
|
||||||
|
soundPlayer = new MediaPlayer(finishSound);
|
||||||
|
soundPlayer.play();
|
||||||
|
soundPlayer.setMute(soundEffectsMuted);
|
||||||
|
}
|
||||||
|
|
||||||
public static void playCapGunSound() {
|
public static void playCapGunSound() {
|
||||||
Media gunSound = new Media(Sounds.class.getClassLoader().getResource("sounds/Gunshot-sound.mp3").toString());
|
Media gunSound = new Media(Sounds.class.getClassLoader().getResource("sounds/Gunshot-sound.mp3").toString());
|
||||||
soundPlayer = new MediaPlayer(gunSound);
|
soundPlayer = new MediaPlayer(gunSound);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package seng302.visualiser;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
@@ -54,6 +55,8 @@ public class GameClient {
|
|||||||
private RaceState raceState = new RaceState();
|
private RaceState raceState = new RaceState();
|
||||||
private LobbyController lobbyController;
|
private LobbyController lobbyController;
|
||||||
|
|
||||||
|
private ArrayList<ClientYacht> finishedBoats = new ArrayList<>();
|
||||||
|
|
||||||
private ObservableList<String> clientLobbyList = FXCollections.observableArrayList();
|
private ObservableList<String> clientLobbyList = FXCollections.observableArrayList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -160,6 +163,10 @@ public class GameClient {
|
|||||||
// server.terminate();
|
// server.terminate();
|
||||||
// server = null;
|
// server = null;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
Sounds.stopSoundEffects();
|
||||||
|
Sounds.stopMusic();
|
||||||
|
Sounds.playMenuMusic();
|
||||||
FXMLLoader fxmlLoader = new FXMLLoader(
|
FXMLLoader fxmlLoader = new FXMLLoader(
|
||||||
getClass().getResource("/views/StartScreenView.fxml"));
|
getClass().getResource("/views/StartScreenView.fxml"));
|
||||||
try {
|
try {
|
||||||
@@ -348,6 +355,9 @@ public class GameClient {
|
|||||||
for (ClientYacht yacht : allBoatsMap.values()) {
|
for (ClientYacht yacht : allBoatsMap.values()) {
|
||||||
if (yacht.getBoatStatus() != BoatStatus.FINISHED.getCode()) {
|
if (yacht.getBoatStatus() != BoatStatus.FINISHED.getCode()) {
|
||||||
raceFinished = false;
|
raceFinished = false;
|
||||||
|
} else if (!finishedBoats.contains(yacht)) {
|
||||||
|
finishedBoats.add(yacht);
|
||||||
|
Sounds.playFinishSound();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,6 +373,7 @@ public class GameClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (raceFinished) {
|
if (raceFinished) {
|
||||||
|
Sounds.playFinishSound();
|
||||||
close();
|
close();
|
||||||
loadFinishScreenView();
|
loadFinishScreenView();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,15 +35,7 @@
|
|||||||
<CompoundMarkSequence>
|
<CompoundMarkSequence>
|
||||||
<Corner SeqID="1" CompoundMarkID="1" Rounding="PS" ZoneSize="3" />
|
<Corner SeqID="1" CompoundMarkID="1" Rounding="PS" ZoneSize="3" />
|
||||||
<Corner SeqID="2" CompoundMarkID="2" Rounding="Port" ZoneSize="3" />
|
<Corner SeqID="2" CompoundMarkID="2" Rounding="Port" ZoneSize="3" />
|
||||||
<Corner SeqID="3" CompoundMarkID="3" Rounding="SP" ZoneSize="3" />
|
<Corner SeqID="3" CompoundMarkID="5" Rounding="PS" ZoneSize="3" />
|
||||||
<Corner SeqID="4" CompoundMarkID="4" Rounding="PS" ZoneSize="3" />
|
|
||||||
<Corner SeqID="5" CompoundMarkID="3" Rounding="SP" ZoneSize="3" />
|
|
||||||
<Corner SeqID="6" CompoundMarkID="4" Rounding="PS" ZoneSize="3" />
|
|
||||||
<Corner SeqID="7" CompoundMarkID="3" Rounding="SP" ZoneSize="3" />
|
|
||||||
<Corner SeqID="8" CompoundMarkID="4" Rounding="PS" ZoneSize="3" />
|
|
||||||
<Corner SeqID="9" CompoundMarkID="3" Rounding="SP" ZoneSize="3" />
|
|
||||||
<Corner SeqID="10" CompoundMarkID="4" Rounding="PS" ZoneSize="3" />
|
|
||||||
<Corner SeqID="11" CompoundMarkID="5" Rounding="PS" ZoneSize="3" />
|
|
||||||
</CompoundMarkSequence>
|
</CompoundMarkSequence>
|
||||||
<CourseLimit>
|
<CourseLimit>
|
||||||
<Limit SeqID="1" Lat="57.6739450" Lon="11.8417100" />
|
<Limit SeqID="1" Lat="57.6739450" Lon="11.8417100" />
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user