private IEnumerator DeathTimeAnimation() { float animLength = deathTimeDilation.keys[deathTimeDilation.length - 1].time; float animStartTime = Time.realtimeSinceStartup; while (animLength >= Time.realtimeSinceStartup - animStartTime) { yield return(null); Time.timeScale = Mathf.Max(0.0f, deathTimeDilation.Evaluate(Time.realtimeSinceStartup - animStartTime)); } TimeManager.ResumeTime(); menu.ChangeMenuTo(2); }