Infinite Runner Engine v2.2
Loading...
Searching...
No Matches
MoreMountains.InfiniteRunnerEngine.SoundManager Class Reference

This persistent singleton handles sound playing. More...

Inheritance diagram for MoreMountains.InfiniteRunnerEngine.SoundManager:
MoreMountains.Tools.MMPersistentSingleton< T >

Public Member Functions

virtual void PlayBackgroundMusic (AudioSource Music)
 Plays a background music. Only one background music can be active at a time.
virtual void StopBackgroundMusic ()
 Stops the background music, if there's one.
virtual AudioSource PlaySound (AudioClip sfx, Vector3 location, bool loop=false)
 Plays a sound.
virtual void StopLoopingSound (AudioSource source)
 Stops the looping sounds if there are any.
virtual void MusicOn ()
virtual void MusicOff ()
virtual void SfxOn ()
virtual void SfxOff ()
virtual void ToggleMusic ()
virtual void ToggleSfx ()
virtual AudioSource GetBackgroundMusic ()
virtual void OnMMSfxEvent (AudioClip clipToPlay, AudioMixerGroup audioGroup=null, float volume=1f, float pitch=1f)

Public Attributes

SoundSettings Settings
float MusicVolume = 0.3f
 true if the music is enabled
float SfxVolume = 1f
 true if the sound fx are enabled
bool MuteSfxOnPause = true
bool MusicToggleButton
bool SfxToggleButton
Public Attributes inherited from MoreMountains.Tools.MMPersistentSingleton< T >
bool AutomaticallyUnparentOnAwake = true
 if this is true, this singleton will auto detach if it finds itself parented on awake

Protected Member Functions

virtual void SetMusic (bool status)
 Sets the music to the specified setting, and stops background music if there's one playing.
virtual void SetSfx (bool status)
virtual void SaveSoundSettings ()
virtual void LoadSoundSettings ()
virtual void ResetSoundSettings ()
virtual void MuteAllSfx ()
virtual void UnmuteAllSfx ()
virtual void OnEnable ()
virtual void OnDisable ()
Protected Member Functions inherited from MoreMountains.Tools.MMPersistentSingleton< T >
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.

Protected Attributes

AudioSource _backgroundMusic
List< AudioSource > _loopingSounds
Protected Attributes inherited from MoreMountains.Tools.MMPersistentSingleton< T >
bool _enabled

Static Protected Attributes

const string _saveFolderName = "InfiniteRunnerEngine/"
const string _saveFileName = "sound.settings"
Static Protected Attributes inherited from MoreMountains.Tools.MMPersistentSingleton< T >
static T _instance

Additional Inherited Members

Properties inherited from MoreMountains.Tools.MMPersistentSingleton< T >
static bool HasInstance [get]
static T Current [get]
static T Instance [get]
 Singleton design pattern.

Detailed Description

This persistent singleton handles sound playing.

Member Function Documentation

◆ GetBackgroundMusic()

virtual AudioSource MoreMountains.InfiniteRunnerEngine.SoundManager.GetBackgroundMusic ( )
virtual

◆ LoadSoundSettings()

virtual void MoreMountains.InfiniteRunnerEngine.SoundManager.LoadSoundSettings ( )
protectedvirtual

◆ MusicOff()

virtual void MoreMountains.InfiniteRunnerEngine.SoundManager.MusicOff ( )
virtual

◆ MusicOn()

virtual void MoreMountains.InfiniteRunnerEngine.SoundManager.MusicOn ( )
virtual

◆ MuteAllSfx()

virtual void MoreMountains.InfiniteRunnerEngine.SoundManager.MuteAllSfx ( )
protectedvirtual

◆ OnDisable()

virtual void MoreMountains.InfiniteRunnerEngine.SoundManager.OnDisable ( )
protectedvirtual

◆ OnEnable()

virtual void MoreMountains.InfiniteRunnerEngine.SoundManager.OnEnable ( )
protectedvirtual

◆ OnMMSfxEvent()

virtual void MoreMountains.InfiniteRunnerEngine.SoundManager.OnMMSfxEvent ( AudioClip clipToPlay,
AudioMixerGroup audioGroup = null,
float volume = 1f,
float pitch = 1f )
virtual

◆ PlayBackgroundMusic()

virtual void MoreMountains.InfiniteRunnerEngine.SoundManager.PlayBackgroundMusic ( AudioSource Music)
virtual

Plays a background music. Only one background music can be active at a time.

Parameters
ClipYour audio clip.

◆ PlaySound()

virtual AudioSource MoreMountains.InfiniteRunnerEngine.SoundManager.PlaySound ( AudioClip sfx,
Vector3 location,
bool loop = false )
virtual

Plays a sound.

Returns
An audiosource
Parameters
sfxThe sound clip you want to play.
locationThe location of the sound.
loopIf set to true, the sound will loop.

◆ ResetSoundSettings()

virtual void MoreMountains.InfiniteRunnerEngine.SoundManager.ResetSoundSettings ( )
protectedvirtual

◆ SaveSoundSettings()

virtual void MoreMountains.InfiniteRunnerEngine.SoundManager.SaveSoundSettings ( )
protectedvirtual

◆ SetMusic()

virtual void MoreMountains.InfiniteRunnerEngine.SoundManager.SetMusic ( bool status)
protectedvirtual

Sets the music to the specified setting, and stops background music if there's one playing.

Parameters
status

◆ SetSfx()

virtual void MoreMountains.InfiniteRunnerEngine.SoundManager.SetSfx ( bool status)
protectedvirtual

◆ SfxOff()

virtual void MoreMountains.InfiniteRunnerEngine.SoundManager.SfxOff ( )
virtual

◆ SfxOn()

virtual void MoreMountains.InfiniteRunnerEngine.SoundManager.SfxOn ( )
virtual

◆ StopBackgroundMusic()

virtual void MoreMountains.InfiniteRunnerEngine.SoundManager.StopBackgroundMusic ( )
virtual

Stops the background music, if there's one.

◆ StopLoopingSound()

virtual void MoreMountains.InfiniteRunnerEngine.SoundManager.StopLoopingSound ( AudioSource source)
virtual

Stops the looping sounds if there are any.

Parameters
sourceSource.

◆ ToggleMusic()

virtual void MoreMountains.InfiniteRunnerEngine.SoundManager.ToggleMusic ( )
virtual

◆ ToggleSfx()

virtual void MoreMountains.InfiniteRunnerEngine.SoundManager.ToggleSfx ( )
virtual

◆ UnmuteAllSfx()

virtual void MoreMountains.InfiniteRunnerEngine.SoundManager.UnmuteAllSfx ( )
protectedvirtual

Member Data Documentation

◆ _backgroundMusic

AudioSource MoreMountains.InfiniteRunnerEngine.SoundManager._backgroundMusic
protected

◆ _loopingSounds

List<AudioSource> MoreMountains.InfiniteRunnerEngine.SoundManager._loopingSounds
protected

◆ _saveFileName

const string MoreMountains.InfiniteRunnerEngine.SoundManager._saveFileName = "sound.settings"
staticprotected

◆ _saveFolderName

const string MoreMountains.InfiniteRunnerEngine.SoundManager._saveFolderName = "InfiniteRunnerEngine/"
staticprotected

◆ MusicToggleButton

bool MoreMountains.InfiniteRunnerEngine.SoundManager.MusicToggleButton

◆ MusicVolume

float MoreMountains.InfiniteRunnerEngine.SoundManager.MusicVolume = 0.3f

true if the music is enabled

the music volume

◆ MuteSfxOnPause

bool MoreMountains.InfiniteRunnerEngine.SoundManager.MuteSfxOnPause = true

◆ Settings

SoundSettings MoreMountains.InfiniteRunnerEngine.SoundManager.Settings

◆ SfxToggleButton

bool MoreMountains.InfiniteRunnerEngine.SoundManager.SfxToggleButton

◆ SfxVolume

float MoreMountains.InfiniteRunnerEngine.SoundManager.SfxVolume = 1f

true if the sound fx are enabled

the sound fx volume


The documentation for this class was generated from the following file: