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 TypeMethodDescriptionvoid
dispose()
Disposes of the sound resources to free memory.static SoundManager
Retrieves the singleton instance of theSoundManager
.void
Initializes the SoundManager manager.void
Pauses fight music.void
Play a sound.void
Play or resume fight music from saved position.void
playMenuMusic
(SoundType type) Play menu or general music.void
Resets the fight music.void
Updates music volume.
-
Method Details
-
getInstance
Retrieves the singleton instance of theSoundManager
.- Returns:
- the single
SoundManager
instance.
-
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.
-