void Attack() { navAgent.velocity = Vector3.zero; navAgent.isStopped = true; attack_Timer += Time.deltaTime; if (attack_Timer > wait_Before_Attack) { enemy_Anim.Attackt(); attack_Timer = 0; //play attack sound enemy_Audio.Play_AttackSound(); } if (Vector3.Distance(transform.position, target.position) > attack_Distance + chase_After_Attack_Distance) { enemy_State = EnemyState.CHASE; } }