public void ApplyDamage(float damage) { // if we died don't execute the rest of the code if (is_Dead) { return; } health -= damage; if (is_Player) { // show the stats(display the health UI value) health_UI.DisplayHealth(health); } if (is_Boar || is_Dragon) { if (enemy_Controller.Enemy_State == EnemyState.PATROL) { enemy_Controller.chase_Distance = 200f; } //if you hit the enemy using long range attack the enemy start chasing you } if (health <= 0f) { PlayerDied(); is_Dead = true; } }//apply damage