This persistent singleton handles sound playing
More...
|
| virtual void | PlayBackgroundMusic (AudioSource musicAudioSource, bool loop=true) |
| | Plays a background music. Only one background music can be active at a time. More...
|
| |
| virtual AudioSource | PlaySound (AudioClip sfx, Vector3 location, bool loop=false) |
| | Plays a sound More...
|
| |
| virtual AudioSource | PlaySound (AudioClip sfx, Vector3 location, float pitch, float pan, float spatialBlend=0.0f, float volumeMultiplier=1.0f, bool loop=false, AudioSource reuseSource=null, AudioMixerGroup audioGroup=null, int priority=128) |
| | Advanced PlaySound method More...
|
| |
| virtual void | StopLoopingSound (AudioSource source) |
| | Stops the looping sounds if there are any More...
|
| |
| virtual void | MusicOn () |
| | Sets the music setting to On More...
|
| |
| virtual void | MusicOff () |
| | Sets the Music setting to Off More...
|
| |
| virtual void | SfxOn () |
| | Sets the SFX setting to On More...
|
| |
| virtual void | SfxOff () |
| | Sets the SFX setting to Off More...
|
| |
| virtual void | StopAllLoopingSounds () |
| | Stops all currently looping sounds More...
|
| |
| virtual void | UnmuteBackgroundMusic () |
| | Unmutes the background music More...
|
| |
| virtual void | MuteBackgroundMusic () |
| | Mutes the background music More...
|
| |
| bool | IsBackgroundMusicInScene () |
| |
| bool | IsBackgroundMusicPlaying () |
| |
| virtual void | PauseBackgroundMusic () |
| |
| virtual void | ResumeBackgroundMusic () |
| |
| virtual void | StopBackgroundMusic () |
| |
| virtual void | OnMMEvent (TopDownEngineEvent engineEvent) |
| | Watches for pause events to cut the sound on pause More...
|
| |
| virtual void | OnMMSfxEvent (AudioClip clipToPlay, AudioMixerGroup audioGroup=null, float volume=1f, float pitch=1f, int priority=128) |
| | When we grab a sfx event, we play the corresponding sound More...
|
| |
| virtual void | OnMMEvent (MMGameEvent gameEvent) |
| | Watches for game events to mute sfx if needed More...
|
| |
| void | OnMMEvent (T eventType) |
| |
| void | OnMMEvent (T eventType) |
| |
|
| virtual void | SetMusic (bool status) |
| | Sets the music on/off setting based on the value in parameters This value will be saved, and any music played after that setting change will comply More...
|
| |
| virtual void | SetSfx (bool status) |
| | Sets the SFX on/off setting based on the value in parameters This value will be saved, and any SFX played after that setting change will comply More...
|
| |
| virtual void | SaveSoundSettings () |
| | Saves the sound settings to file More...
|
| |
| virtual void | LoadSoundSettings () |
| | Loads the sound settings from file (if found) More...
|
| |
| virtual void | ResetSoundSettings () |
| | Resets the sound settings by destroying the save file More...
|
| |
| virtual void | MuteAllSfx () |
| | Mutes all sfx currently playing More...
|
| |
| virtual void | UnmuteAllSfx () |
| | Unmutes all sfx currently playing More...
|
| |
| virtual void | OnEnable () |
| | On enable we start listening for events More...
|
| |
| virtual void | OnDisable () |
| | On disable we stop listening for events More...
|
| |
| virtual void | Awake () |
| | On awake, we check if there's already a copy of the object in the scene. If there's one, we destroy it. More...
|
| |
| virtual void | InitializeSingleton () |
| | Initializes the singleton. More...
|
| |
This persistent singleton handles sound playing
◆ IsBackgroundMusicInScene()
| bool MoreMountains.TopDownEngine.SoundManager.IsBackgroundMusicInScene |
( |
| ) |
|
◆ IsBackgroundMusicPlaying()
| bool MoreMountains.TopDownEngine.SoundManager.IsBackgroundMusicPlaying |
( |
| ) |
|
◆ LoadSoundSettings()
| virtual void MoreMountains.TopDownEngine.SoundManager.LoadSoundSettings |
( |
| ) |
|
|
protectedvirtual |
Loads the sound settings from file (if found)
◆ MusicOff()
| virtual void MoreMountains.TopDownEngine.SoundManager.MusicOff |
( |
| ) |
|
|
virtual |
Sets the Music setting to Off
◆ MusicOn()
| virtual void MoreMountains.TopDownEngine.SoundManager.MusicOn |
( |
| ) |
|
|
virtual |
Sets the music setting to On
◆ MuteAllSfx()
| virtual void MoreMountains.TopDownEngine.SoundManager.MuteAllSfx |
( |
| ) |
|
|
protectedvirtual |
Mutes all sfx currently playing
◆ MuteBackgroundMusic()
| virtual void MoreMountains.TopDownEngine.SoundManager.MuteBackgroundMusic |
( |
| ) |
|
|
virtual |
Mutes the background music
◆ OnDisable()
| virtual void MoreMountains.TopDownEngine.SoundManager.OnDisable |
( |
| ) |
|
|
protectedvirtual |
On disable we stop listening for events
◆ OnEnable()
| virtual void MoreMountains.TopDownEngine.SoundManager.OnEnable |
( |
| ) |
|
|
protectedvirtual |
On enable we start listening for events
◆ OnMMEvent() [1/2]
| virtual void MoreMountains.TopDownEngine.SoundManager.OnMMEvent |
( |
MMGameEvent |
gameEvent | ) |
|
|
virtual |
Watches for game events to mute sfx if needed
- Parameters
-
◆ OnMMEvent() [2/2]
| virtual void MoreMountains.TopDownEngine.SoundManager.OnMMEvent |
( |
TopDownEngineEvent |
engineEvent | ) |
|
|
virtual |
Watches for pause events to cut the sound on pause
- Parameters
-
◆ OnMMSfxEvent()
| virtual void MoreMountains.TopDownEngine.SoundManager.OnMMSfxEvent |
( |
AudioClip |
clipToPlay, |
|
|
AudioMixerGroup |
audioGroup = null, |
|
|
float |
volume = 1f, |
|
|
float |
pitch = 1f, |
|
|
int |
priority = 128 |
|
) |
| |
|
virtual |
When we grab a sfx event, we play the corresponding sound
- Parameters
-
◆ PauseBackgroundMusic()
| virtual void MoreMountains.TopDownEngine.SoundManager.PauseBackgroundMusic |
( |
| ) |
|
|
virtual |
◆ PlayBackgroundMusic()
| virtual void MoreMountains.TopDownEngine.SoundManager.PlayBackgroundMusic |
( |
AudioSource |
musicAudioSource, |
|
|
bool |
loop = true |
|
) |
| |
|
virtual |
Plays a background music. Only one background music can be active at a time.
- Parameters
-
◆ PlaySound() [1/2]
| virtual AudioSource MoreMountains.TopDownEngine.SoundManager.PlaySound |
( |
AudioClip |
sfx, |
|
|
Vector3 |
location, |
|
|
bool |
loop = false |
|
) |
| |
|
virtual |
Plays a sound
- Returns
- An audiosource
- Parameters
-
| sfx | The sound clip you want to play. |
| location | The location of the sound. |
| loop | If set to true, the sound will loop. |
◆ PlaySound() [2/2]
| virtual AudioSource MoreMountains.TopDownEngine.SoundManager.PlaySound |
( |
AudioClip |
sfx, |
|
|
Vector3 |
location, |
|
|
float |
pitch, |
|
|
float |
pan, |
|
|
float |
spatialBlend = 0.0f, |
|
|
float |
volumeMultiplier = 1.0f, |
|
|
bool |
loop = false, |
|
|
AudioSource |
reuseSource = null, |
|
|
AudioMixerGroup |
audioGroup = null, |
|
|
int |
priority = 128 |
|
) |
| |
|
virtual |
Advanced PlaySound method
- Parameters
-
| sfx | |
| location | |
| pitch | |
| pan | |
| spatialBlend | |
| volumeMultiplier | |
| loop | |
| reuseSource | |
| audioGroup | |
| soundFadeInDuration | |
- Returns
◆ ResetSoundSettings()
| virtual void MoreMountains.TopDownEngine.SoundManager.ResetSoundSettings |
( |
| ) |
|
|
protectedvirtual |
Resets the sound settings by destroying the save file
◆ ResumeBackgroundMusic()
| virtual void MoreMountains.TopDownEngine.SoundManager.ResumeBackgroundMusic |
( |
| ) |
|
|
virtual |
◆ SaveSoundSettings()
| virtual void MoreMountains.TopDownEngine.SoundManager.SaveSoundSettings |
( |
| ) |
|
|
protectedvirtual |
Saves the sound settings to file
◆ SetMusic()
| virtual void MoreMountains.TopDownEngine.SoundManager.SetMusic |
( |
bool |
status | ) |
|
|
protectedvirtual |
Sets the music on/off setting based on the value in parameters This value will be saved, and any music played after that setting change will comply
- Parameters
-
◆ SetSfx()
| virtual void MoreMountains.TopDownEngine.SoundManager.SetSfx |
( |
bool |
status | ) |
|
|
protectedvirtual |
Sets the SFX on/off setting based on the value in parameters This value will be saved, and any SFX played after that setting change will comply
- Parameters
-
◆ SfxOff()
| virtual void MoreMountains.TopDownEngine.SoundManager.SfxOff |
( |
| ) |
|
|
virtual |
Sets the SFX setting to Off
◆ SfxOn()
| virtual void MoreMountains.TopDownEngine.SoundManager.SfxOn |
( |
| ) |
|
|
virtual |
Sets the SFX setting to On
◆ StopAllLoopingSounds()
| virtual void MoreMountains.TopDownEngine.SoundManager.StopAllLoopingSounds |
( |
| ) |
|
|
virtual |
Stops all currently looping sounds
◆ StopBackgroundMusic()
| virtual void MoreMountains.TopDownEngine.SoundManager.StopBackgroundMusic |
( |
| ) |
|
|
virtual |
◆ StopLoopingSound()
| virtual void MoreMountains.TopDownEngine.SoundManager.StopLoopingSound |
( |
AudioSource |
source | ) |
|
|
virtual |
Stops the looping sounds if there are any
- Parameters
-
◆ UnmuteAllSfx()
| virtual void MoreMountains.TopDownEngine.SoundManager.UnmuteAllSfx |
( |
| ) |
|
|
protectedvirtual |
Unmutes all sfx currently playing
◆ UnmuteBackgroundMusic()
| virtual void MoreMountains.TopDownEngine.SoundManager.UnmuteBackgroundMusic |
( |
| ) |
|
|
virtual |
Unmutes the background music
◆ _backgroundMusic
| AudioSource MoreMountains.TopDownEngine.SoundManager._backgroundMusic |
|
protected |
◆ _loopingSounds
| List<AudioSource> MoreMountains.TopDownEngine.SoundManager._loopingSounds = new List<AudioSource>() |
|
protected |
◆ _saveFileName
| const string MoreMountains.TopDownEngine.SoundManager._saveFileName = "sound.settings" |
|
staticprotected |
◆ _saveFolderName
| const string MoreMountains.TopDownEngine.SoundManager._saveFolderName = "TopDownEngine/" |
|
staticprotected |
◆ MusicVolume
| float MoreMountains.TopDownEngine.SoundManager.MusicVolume = 0.3f |
◆ MuteSfxOnPause
| bool MoreMountains.TopDownEngine.SoundManager.MuteSfxOnPause = true |
whether or not Sfx should be muted when the game is paused
◆ Settings
the current sound settings
◆ SfxVolume
| float MoreMountains.TopDownEngine.SoundManager.SfxVolume = 1f |
◆ IsMusicOn
| virtual bool MoreMountains.TopDownEngine.SoundManager.IsMusicOn |
|
getset |
◆ IsSfxOn
| virtual bool MoreMountains.TopDownEngine.SoundManager.IsSfxOn |
|
getset |
The documentation for this class was generated from the following file:
- F:/Github/Store/TopDownEngine/Assets/TopDownEngine/Common/Scripts/Managers/SoundManager.cs