private IEnumerator PlayerDeathSequence(Entity.DeathType deathCause) { if (player != null) { // Do these things instantly when player dies if (deathCause != Entity.DeathType.DROWNING) { overlayAnim.SetTrigger("Player_Death"); } Time.timeScale = 0.2f; // Disable player scripts GameMaster.player.GetComponent <PlayerZooming>().allowZooming = false; yield return(new WaitForSeconds(0.2f)); // Do these things when map is not visible (game over animation) foreach (Object obj in removeOnPlayerDeath) { Destroy(obj); } if (player.GetComponent <PlayerZooming>() != null) { player.GetComponent <PlayerZooming>().ZoomToValue(26); } //player = null; // Reset camera clamp Camera.main.GetComponent <CameraClamp>().ChangeViewport(0, 0, 0, 0); Time.timeScale = 1.0f; yield return(new WaitForSeconds(0.8f)); // Do these things when map is visible again } }
public static void PlayerDeath(Entity.DeathType deathCause) { isPlayerDead = true; instance.StartCoroutine(instance.PlayerDeathSequence(deathCause)); }