Package com.bomber7.utils
Class SoundManager
java.lang.Object
com.bomber7.utils.SoundManager
SoundManager manages sound effects used in the game.
-
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Disposes of the sound resources to free memory.static SoundManagerRetrieves the singleton instance of theSoundManager.voidInitializes the SoundManager manager.voidPauses fight music.voidPlay a sound.voidPlay or resume fight music from saved position.voidplayMenuMusic(SoundType type) Play menu or general music.voidResets the fight music.voidUpdates music volume.
-
Method Details
-
getInstance
Retrieves the singleton instance of theSoundManager.- Returns:
- the single
SoundManagerinstance.
-
initialize
public void initialize()Initializes the SoundManager manager.This method must be called before any sound access / play occurs.
-
play
Play a sound.- Parameters:
type- the sound to play
-
playMenuMusic
Play menu or general music. Automatically pauses fight music if it's playing.- Parameters:
type- the music type to play
-
playFightMusic
public void playFightMusic()Play or resume fight music from saved position. Starts random fight music if none exists. -
resetFightMusic
public void resetFightMusic()Resets the fight music. -
pauseFightMusic
public void pauseFightMusic()Pauses fight music. -
updateMusicVolume
public void updateMusicVolume()Updates music volume. Has to be called whenever the music volume is modified, so the modification is applied instantly. -
dispose
public void dispose()Disposes of the sound resources to free memory. Should be called when the sounds are no longer needed.
-