void Update() { timeInLevel += Time.deltaTime; playerRespawnTimer.Update(Time.deltaTime); levelEndDelayTimer.Update(Time.deltaTime); if (Input.GetButtonDown("Escape")) { player.Deactivate(); vignette.FadeOut(); levelEndDelayTimer.SetEventFunction(() => ReturnToMenu()); levelEndDelayTimer.Restart(); GameObject.FindGameObjectWithTag("Music").GetComponent <MusicSingletonScript>().FadeOut(musicFade, musicFadeTime); } }
private void FadeOut() { fade.FadeOut(); lifetime.SetTargetTime(fade.fadeOutTime); lifetime.SetEventFunction(() => SwitchScene()); lifetime.Restart(); }