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(); } } }
private IEnumerator WaitLoadGame() { _screenFader.Fade(1); yield return(new WaitForSeconds(_wait)); GameManager.GetInstance().LoadGame(); }