v3.11.4 Documentation
Fungus.MusicManager Class Reference

Music manager which provides basic music and sound effect functionality. More...

Inheritance diagram for Fungus.MusicManager:

Public Member Functions

void PlayMusic (AudioClip musicClip, bool loop, float fadeDuration, float atTime)
 Plays game music using an audio clip. More...
 
virtual void PlaySound (AudioClip soundClip, float volume)
 Plays a sound effect once, at the specified volume. More...
 
virtual void PlayAmbianceSound (AudioClip soundClip, bool loop, float volume)
 Plays a sound effect with optional looping values, at the specified volume. More...
 
virtual void SetAudioPitch (float pitch, float duration, System.Action onComplete)
 Shifts the game music pitch to required value over a period of time. More...
 
virtual void SetAudioVolume (float volume, float duration, System.Action onComplete)
 Fades the game music volume to required level over a period of time. More...
 
virtual void StopMusic ()
 Stops playing game music. More...
 
virtual void StopAmbiance ()
 Stops playing game ambiance. More...
 

Protected Member Functions

virtual void Awake ()
 
virtual void Start ()
 

Protected Attributes

AudioSource audioSourceMusic
 
AudioSource audioSourceAmbiance
 
AudioSource audioSourceSoundEffect
 

Detailed Description

Music manager which provides basic music and sound effect functionality.

Music playback persists across scene loads.

Definition at line 13 of file MusicManager.cs.

Member Function Documentation

◆ Awake()

virtual void Fungus.MusicManager.Awake ( )
protectedvirtual

Definition at line 27 of file MusicManager.cs.

◆ PlayAmbianceSound()

virtual void Fungus.MusicManager.PlayAmbianceSound ( AudioClip  soundClip,
bool  loop,
float  volume 
)
virtual

Plays a sound effect with optional looping values, at the specified volume.

Parameters
soundClipThe sound effect clip to play.
loopIf the audioclip should loop or not.
volumeThe volume level of the sound effect.

Definition at line 97 of file MusicManager.cs.

◆ PlayMusic()

void Fungus.MusicManager.PlayMusic ( AudioClip  musicClip,
bool  loop,
float  fadeDuration,
float  atTime 
)

Plays game music using an audio clip.

One music clip may be played at a time.

Definition at line 48 of file MusicManager.cs.

◆ PlaySound()

virtual void Fungus.MusicManager.PlaySound ( AudioClip  soundClip,
float  volume 
)
virtual

Plays a sound effect once, at the specified volume.

Parameters
soundClipThe sound effect clip to play.
volumeThe volume level of the sound effect.

Definition at line 86 of file MusicManager.cs.

◆ SetAudioPitch()

virtual void Fungus.MusicManager.SetAudioPitch ( float  pitch,
float  duration,
System.Action  onComplete 
)
virtual

Shifts the game music pitch to required value over a period of time.

Parameters
pitchThe new music pitch value.
durationThe length of time in seconds needed to complete the pitch change.
onCompleteA delegate method to call when the pitch shift has completed.

Definition at line 111 of file MusicManager.cs.

◆ SetAudioVolume()

virtual void Fungus.MusicManager.SetAudioVolume ( float  volume,
float  duration,
System.Action  onComplete 
)
virtual

Fades the game music volume to required level over a period of time.

Parameters
volumeThe new music volume value [0..1]
durationThe length of time in seconds needed to complete the volume change.
onCompleteDelegate function to call when fade completes.

Definition at line 146 of file MusicManager.cs.

◆ Start()

virtual void Fungus.MusicManager.Start ( )
protectedvirtual

Definition at line 36 of file MusicManager.cs.

◆ StopAmbiance()

virtual void Fungus.MusicManager.StopAmbiance ( )
virtual

Stops playing game ambiance.

Definition at line 185 of file MusicManager.cs.

◆ StopMusic()

virtual void Fungus.MusicManager.StopMusic ( )
virtual

Stops playing game music.

Definition at line 176 of file MusicManager.cs.

Member Data Documentation

◆ audioSourceAmbiance

AudioSource Fungus.MusicManager.audioSourceAmbiance
protected

Definition at line 16 of file MusicManager.cs.

◆ audioSourceMusic

AudioSource Fungus.MusicManager.audioSourceMusic
protected

Definition at line 15 of file MusicManager.cs.

◆ audioSourceSoundEffect

AudioSource Fungus.MusicManager.audioSourceSoundEffect
protected

Definition at line 17 of file MusicManager.cs.


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