Added mark rounding noise and hover button noise.

#story[1249]
This commit is contained in:
Kusal Ekanayake
2017-09-05 14:33:37 +12:00
parent 396098e009
commit 1619c95098
7 changed files with 35 additions and 11 deletions
+23 -6
View File
@@ -19,16 +19,22 @@ public class Sounds {
public static void stopMusic() {
musicPlayer.stop();
if (musicPlayer != null) {
musicPlayer.stop();
}
}
public static void stopSoundEffects() {
soundEffect.stop();
if (soundEffect != null) {
soundEffect.stop();
}
}
public static void toggleMuteMusic() {
musicMuted = !musicMuted;
musicPlayer.setMute(musicMuted);
if (musicPlayer != null) {
musicPlayer.setMute(musicMuted);
}
}
public static void toggleMuteEffects() {
@@ -83,21 +89,32 @@ public class Sounds {
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 playMarkRoundingSound() {
Media markRoundingSound = new Media(Sounds.class.getClassLoader().getResource("sounds/sms-tone.mp3").toString());
soundPlayer = new MediaPlayer(markRoundingSound);
soundPlayer.play();
}
public static void playCapGunSound() {
Media gunSound = new Media(Sounds.class.getClassLoader().getResource("sounds/Gunshot-sound.mp3").toString());
soundPlayer = new MediaPlayer(gunSound);
soundPlayer.play();
soundPlayer.setMute(soundEffectsMuted);
}
public static void playCrashSound() {
Media crashSound = new Media(Sounds.class.getClassLoader().getResource("sounds/Large-metal-door-slam.mp3").toString());
soundPlayer = new MediaPlayer(crashSound);
soundPlayer.play();
soundPlayer.setMute(soundEffectsMuted);
}
public static void playHoverSound() {
Media hoverSound = new Media(Sounds.class.getClassLoader().getResource("sounds/sound-over.wav").toString());
soundPlayer = new MediaPlayer(hoverSound);
soundPlayer.play();
}
}
@@ -164,7 +164,6 @@ public class GameClient {
// server = null;
// }
Sounds.stopSoundEffects();
Sounds.stopMusic();
Sounds.playMenuMusic();
FXMLLoader fxmlLoader = new FXMLLoader(
@@ -36,6 +36,7 @@ import seng302.model.mark.CompoundMark;
import seng302.model.mark.Corner;
import seng302.model.mark.Mark;
import seng302.utilities.GeoUtility;
import seng302.utilities.Sounds;
import seng302.visualiser.fxObjects.AnnotationBox;
import seng302.visualiser.fxObjects.BoatObject;
import seng302.visualiser.fxObjects.CourseBoundary;
@@ -785,12 +786,14 @@ public class GameView extends Pane {
private void updateMarkArrows (ClientYacht yacht, CompoundMark compoundMark, int legNumber) {
//Only show arrows for this and next leg.
if (compoundMark != null) {
Sounds.playMarkRoundingSound();
for (Mark mark : compoundMark.getMarks()) {
markerObjects.get(mark).showNextExitArrow();
}
}
CompoundMark nextMark = null;
if (legNumber < course.size() - 1) {
Sounds.playMarkRoundingSound();
nextMark = course.get(legNumber);
for (Mark mark : nextMark.getMarks()) {
markerObjects.get(mark).showNextEnterArrow();
@@ -11,6 +11,7 @@ import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TextField;
import javafx.scene.control.ToggleButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.GridPane;
import seng302.gameServer.GameState;
@@ -205,4 +206,8 @@ public class StartScreenController implements Initializable {
muteSoundsButton.setText("Mute Sounds");
}
}
public void playButtonHoverSound(MouseEvent mouseEvent) {
Sounds.playHoverSound();
}
}