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.
|
| virtual AudioSource | PlaySound (AudioClip sfx, Vector3 location, bool loop=false) |
| | Plays a sound.
|
| 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.
|
| virtual void | StopLoopingSound (AudioSource source) |
| | Stops the looping sounds if there are any.
|
| virtual void | MusicOn () |
| | Sets the music setting to On.
|
| virtual void | MusicOff () |
| | Sets the Music setting to Off.
|
| virtual void | SfxOn () |
| | Sets the SFX setting to On.
|
| virtual void | SfxOff () |
| | Sets the SFX setting to Off.
|
| virtual void | StopAllLoopingSounds () |
| | Stops all currently looping sounds.
|
| virtual void | UnmuteBackgroundMusic () |
| | Unmutes the background music.
|
| virtual void | MuteBackgroundMusic () |
| | Mutes the background music.
|
| 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.
|
| 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.
|
| virtual void | OnMMEvent (MMGameEvent gameEvent) |
| | Watches for game events to mute sfx if needed.
|
| 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.
|
| 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.
|
| virtual void | SaveSoundSettings () |
| | Saves the sound settings to file.
|
| virtual void | LoadSoundSettings () |
| | Loads the sound settings from file (if found)
|
| virtual void | ResetSoundSettings () |
| | Resets the sound settings by destroying the save file.
|
| virtual void | MuteAllSfx () |
| | Mutes all sfx currently playing.
|
| virtual void | UnmuteAllSfx () |
| | Unmutes all sfx currently playing.
|
| virtual void | OnEnable () |
| | On enable we start listening for events.
|
| virtual void | OnDisable () |
| | On disable we stop listening for events.
|
| 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.
|
| virtual void | InitializeSingleton () |
| | Initializes the singleton.
|
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:
- H:/Code/MoreMountains/topdownengine/Assets/TopDownEngine/Common/Scripts/Managers/SoundManager.cs