Settings
This commit is contained in:
@@ -18,7 +18,7 @@ public class MusicPlayer {
|
||||
if (music == Musics.MAIN_MENU_MUSIC) {
|
||||
musicClip = SoundLoader.loadMusic(Musics.MAIN_MENU_MUSIC.getSoundsPath());
|
||||
if (musicClip != null) {
|
||||
setVolume(musicClip, Options.DEFAULT_VOLUME);
|
||||
setVolume(musicClip, Options.MUSIC_VOLUME);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,20 +27,20 @@ public class MusicPlayer {
|
||||
if (sound == Sounds.SOUNDS1) {
|
||||
soundClip = SoundLoader.loadMusic(Sounds.SOUNDS1.getSoundsPath()); // Utilise soundClip pour les bruitages
|
||||
if (soundClip != null) {
|
||||
setVolume(soundClip, Options.DEFAULT_VOLUME);
|
||||
setVolume(soundClip, Options.SOUNDS_VOLUME);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void playMusic() {
|
||||
if (musicClip != null && !isPlayingMusic) {
|
||||
if (musicClip != null && !isPlayingMusic && !Options.MUSIC_MUTED) {
|
||||
musicClip.start();
|
||||
isPlayingMusic = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void playSound() {
|
||||
if (soundClip != null && !isPlayingSound) {
|
||||
if (soundClip != null && !isPlayingSound && !Options.SOUNDS_MUTED) {
|
||||
soundClip.start();
|
||||
isPlayingSound = true;
|
||||
soundClip.addLineListener(event -> { // Réinitialiser isPlayingSound à la fin du son
|
||||
@@ -83,4 +83,12 @@ public class MusicPlayer {
|
||||
public static boolean isPlayingSound() {
|
||||
return isPlayingSound;
|
||||
}
|
||||
}
|
||||
|
||||
public static Clip getMusicClip() {
|
||||
return musicClip;
|
||||
}
|
||||
|
||||
public static Clip getSoundClip() {
|
||||
return soundClip;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user