public override void PerformBehavior() { if (targetStats == null || targetStats.IsDead) { npcController.SetState(npcController.GetResetState()); return; } if (Time.time - lastCheckTime > 0.75f) { lastCheckTime = Time.time; if (npcController.CanAttack()) { agent.ResetPath(); npcController.SetState(npcController.GetAttackState()); return; } } if (Vector3.Distance(target.position, transform.position) > attackRange + attackRangeOffset) { agent.SetDestination(target.position); } else { agent.ResetPath(); npcController.SetState(npcController.GetAttackState()); } }