public override void Update() { // if we are not already dead, then check for the player health var isInDeathState = (this is AIStateDead); if (!isInDeathState) { if (!controller.enabled) { // Player is no longer alive. Move to the dead state var deadState = new AIStateDead(controller); stateMachine.MoveTo(deadState); } } HandleFrameUpdate(Time.deltaTime); }