private IEnumerator StartFade(AnimationClip clip) { if (IsPlaying) { yield break; } FadeAnimation.clip = clip; FadeAnimation.Rewind(); FadeAnimation.Play(); IsPlaying = true; yield return(new WaitForSeconds(clip.length)); IsPlaying = false; OnFadeEnded?.Invoke(); RemoveAllListeners(); }
/// <summary>A hook into the fade-from-black animation. Called at the end. /// Triggered by <see cref="BeginFade"/></summary> public void FadeEnded() { fader.blocksRaycasts = false; fader.gameObject.SetActive(false); OnFadeEnded?.Invoke(); }