void Update() { if (null != current) { current.Update(); } if (null != next) { if (next.IsReady() && current == null) { current = next; current.Play(); next = null; } } }
void Update() { if (null != last) { last.Update(); } if (null != current) { current.Update(); } if (null != current) { if (current.IsReady() && last == null) { current.Play(); } } }
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; } }
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); } }