void Update() { StateManager(); //animations if (agent.desiredVelocity.magnitude >= 0.1) { animate.Walk(true); } else { animate.Walk(false); } animate.Alert(isAlert); //show health bar if (IsNearPlayer()) { canvasHP.SetActive(true); } else { canvasHP.SetActive(false); } }