ScreenFader.Fade C# (CSharp) Method

Fade() private method

private Fade ( float from, float to, float seconds, Action callback ) : IEnumerator
from float
to float
seconds float
callback Action
return IEnumerator
    private IEnumerator Fade(float from, float to, float seconds, Action callback)
    {
        if (faderMaterial != null)
        {
            float progress = 0.0f;

            while (progress <= 1.0f)
            {
                progress = progress + (Time.deltaTime / seconds);
                SetAlpha(Mathf.Lerp(from, to, progress));
                yield return null;
            }

            if (callback != null)
            {
                callback.Invoke();
            }
        }
    }

Same methods

ScreenFader::Fade ( ) : IEnumerator
ScreenFader::Fade ( Action fadeStart, Action fadeMiddle, Action fadeEnd ) : void

Usage Example

コード例 #1
0
    private IEnumerator WaitLoadGame()
    {
        _screenFader.Fade(1);
        yield return(new WaitForSeconds(_wait));

        GameManager.GetInstance().LoadGame();
    }
All Usage Examples Of ScreenFader::Fade