//サウンドを終了 public void Stop(float fadeTime) { if (null != last) { last.End(); } if (null != current) { current.FadeOut(fadeTime); } }
internal SoundStream Play(AudioClip clip, float fadeTime, float masterVolume, float volume, bool isLoop, bool isStreaming, Action callBackEnd) { if (null != next) { GameObject.Destroy(next.gameObject); } if (null == current) { current = UtageToolKit.AddChildGameObjectComponent <SoundStream>(this.transform, clip.name); //即時再生 current.Play(clip, masterVolume, volume, isLoop, isStreaming, callBackEnd); return(current); } else { //フェードアウト後に再生 current.FadeOut(fadeTime); next = UtageToolKit.AddChildGameObjectComponent <SoundStream>(this.transform, clip.name); next.Ready(clip, masterVolume, volume, isLoop, isStreaming, callBackEnd); return(next); } }
internal SoundStream Play(AudioClip clip, float fadeTime, float volume, bool isLoop, bool isStreaming, Func<float> callbackMasterVolume, Action callbackEnd) { if (null != last) GameObject.Destroy(last.gameObject); if (null == current) { current = UtageToolKit.AddChildGameObjectComponent<SoundStream>(this.transform, clip.name); //即時再生 current.Play(clip, volume, isLoop, isStreaming, callbackMasterVolume, callbackEnd); return current; } else { //フェードアウト後に再生 last = current; last.FadeOut(fadeTime); current = UtageToolKit.AddChildGameObjectComponent<SoundStream>(this.transform, clip.name); current.Ready(clip, volume, isLoop, isStreaming, callbackMasterVolume, callbackEnd); return current; } }