using System.Collections; using System.Collections.Generic; using Platformer.Core; using Platformer.Model; using UnityEngine; namespace Platformer.Gameplay { /// /// Fired when the player has died. /// /// public class PlayerDeath : Simulation.Event { PlatformerModel model = Simulation.GetModel(); public override void Execute() { var player = model.player; if (player.health.IsAlive) { player.health.Die(); model.virtualCamera.m_Follow = null; model.virtualCamera.m_LookAt = null; // player.collider.enabled = false; player.controlEnabled = false; if (player.audioSource && player.ouchAudio) player.audioSource.PlayOneShot(player.ouchAudio); player.animator.SetTrigger("hurt"); player.animator.SetBool("dead", true); Simulation.Schedule(2); } } } }