Beispiel #1
0
    private void RemoveAllListeners()
    {
        if (OnFadeEnded == null)
        {
            return;
        }

        foreach (Delegate del in OnFadeEnded.GetInvocationList())
        {
            OnFadeEnded -= (OnFadeEnd)del;
        }
    }
Beispiel #2
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();
    }
Beispiel #3
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();
 }