Fade.FadeoutCoroutine C# (CSharp) Method

FadeoutCoroutine() private method

private FadeoutCoroutine ( float time, System action ) : IEnumerator
time float
action System
return IEnumerator
    IEnumerator FadeoutCoroutine(float time, System.Action action)
    {
        float endTime = Time.timeSinceLevelLoad + time * (cutoutRange);

        var endFrame = new WaitForEndOfFrame ();

        while (Time.timeSinceLevelLoad <= endTime) {
            cutoutRange = (endTime - Time.timeSinceLevelLoad) / time;
            fade.Range = cutoutRange;
            yield return endFrame;
        }
        cutoutRange = 0;
        fade.Range = cutoutRange;

        if (action != null) {
            action ();
        }
    }