Class SFXManager
java.lang.Object
util.SFXManager
Manages sound effects (SFX) in the game.
Allows loading, playing, stopping, and adjusting volume of sound effects.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static doubleGlobal volume for all sound effects (0.0 to 1.0).Stores loaded sound effects by name. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidLoads a sound effect from the given path and associates it with a name.static voidPlays a loaded sound effect by name.static voidsetVolume(double volume) Sets the global volume for all sound effects.static voidStops a sound effect by name if it is playing.static voidstopAll()Stops all currently playing sound effects.
-
Field Details
-
sounds
-
globalVolume
private static double globalVolumeGlobal volume for all sound effects (0.0 to 1.0).
-
-
Constructor Details
-
SFXManager
public SFXManager()
-
-
Method Details
-
load
-
play
Plays a loaded sound effect by name.- Parameters:
name- the name of the sound effect
-
setVolume
public static void setVolume(double volume) Sets the global volume for all sound effects.- Parameters:
volume- volume between 0.0 (mute) and 1.0 (max)
-
stop
Stops a sound effect by name if it is playing.- Parameters:
name- the name of the sound effect
-
stopAll
public static void stopAll()Stops all currently playing sound effects.
-