|
|
|
@ -11,21 +11,32 @@ namespace Fungus
|
|
|
|
|
{ |
|
|
|
|
[Range(0,1)] |
|
|
|
|
[Tooltip("Global volume level for audio played using Play Music and Play Sound")] |
|
|
|
|
public float volume = 1; |
|
|
|
|
public float volume = 1f; |
|
|
|
|
|
|
|
|
|
[Range(0,30)] |
|
|
|
|
[Tooltip("Time to fade between current volume level and target volume level.")] |
|
|
|
|
public float fadeDuration; |
|
|
|
|
public float fadeDuration = 1f; |
|
|
|
|
|
|
|
|
|
[Tooltip("Wait until the volume fade has completed before continuing.")] |
|
|
|
|
public bool waitUntilFinished = true; |
|
|
|
|
|
|
|
|
|
public override void OnEnter() |
|
|
|
|
{ |
|
|
|
|
MusicController musicController = MusicController.GetInstance(); |
|
|
|
|
if (musicController != null) |
|
|
|
|
{ |
|
|
|
|
musicController.SetAudioVolume(volume, fadeDuration); |
|
|
|
|
musicController.SetAudioVolume(volume, fadeDuration, () => { |
|
|
|
|
if (waitUntilFinished) |
|
|
|
|
{ |
|
|
|
|
Continue(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!waitUntilFinished) |
|
|
|
|
{ |
|
|
|
|
Continue(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override string GetSummary() |
|
|
|
|