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