Class AirAnimalSoundPlayer
java.lang.Object
com.csse3200.game.components.audio.AirAnimalSoundPlayer
This class is responsible for managing the playback of air-animal-related sounds,
focusing on sounds such as wings flapping and bird screeching. It uses the AudioManager
to control the volume levels.
-
Constructor Summary
ConstructorsConstructorDescriptionAirAnimalSoundPlayer
(String flappingSoundPath, String screechSoundPath) Constructs a new AirAnimalSoundPlayer with specific paths to the flapping and screeching sound assets. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Plays the wings flapping sound in a loop at the volume specified by the AudioManager.void
Plays the bird screech sound once at the volume specified by the AudioManager.void
Stops the wings flapping sound if it is currently playing.void
updateFlappingSound
(boolean isFlying) Updates the playing state of the wings flapping sound based on the animal's flying state.
-
Constructor Details
-
AirAnimalSoundPlayer
Constructs a new AirAnimalSoundPlayer with specific paths to the flapping and screeching sound assets.- Parameters:
flappingSoundPath
- Path to the flapping sound file.screechSoundPath
- Path to the screeching sound file.
-
-
Method Details
-
playFlappingSound
public void playFlappingSound()Plays the wings flapping sound in a loop at the volume specified by the AudioManager. If the sound is already playing, this method does nothing. -
stopFlappingSound
public void stopFlappingSound()Stops the wings flapping sound if it is currently playing. Resets the identifier to ensure it can be restarted. -
updateFlappingSound
public void updateFlappingSound(boolean isFlying) Updates the playing state of the wings flapping sound based on the animal's flying state. Plays or stops the wings flapping sound based on whether the air animal is flying.- Parameters:
isFlying
- True if the air animal is flying and the sound should be played; false otherwise.
-
playScreechSound
public void playScreechSound()Plays the bird screech sound once at the volume specified by the AudioManager.
-