Ejemplo n.º 1
0
    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();
    }
Ejemplo n.º 2
0
 /// <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();
 }