Ejemplo n.º 1
0
    private IEnumerator FadeOut()
    {
        float value = 1;

        OnFadeOutStart.Invoke();
        while (value > 0)
        {
            value            -= 0.05f;
            canvasGroup.alpha = value;
            yield return(new WaitForEndOfFrame());
        }
        OnFadeOutEnd.Invoke();
        FadeOutComplete();
        gameObject.SetActive(false);
    }
Ejemplo n.º 2
0
    IEnumerator FadeOut()
    {
        OnFadeOutStart?.Invoke(eventData);
        image.enabled = true;
        image.color   = Color.black;
        timer         = time;
        float process;

        while (timer >= 0)
        {
            timer      -= Time.deltaTime;
            process     = timer / time;
            image.color = new Color(0, 0, 0, process);
            yield return(0);
        }
        image.enabled = false;
        timer         = -0f;
        OnFadeOutDone?.Invoke(eventData);
    }