public override void ActiveBehavior(AIController ai) { //DEBUG LINE DRAWING AI.Util.DrawPath(ai.transform.position, movement.pathToDestination, ai.treeUpdateInterval * Time.fixedDeltaTime); if (!ai.localBlackboard.GetProperty <bool>(AIPawn.PROPERTY_AGGRO) || target == null) { _currentPhase = StatePhase.EXITING; return; } bool doPathCalculation = false; if ((ai.transform.position - target.transform.position).sqrMagnitude > recalculatePathDistance * recalculatePathDistance) { doPathCalculation = true; } if ((ai.transform.position - target.transform.position).sqrMagnitude <= weapon.reach * weapon.reach) { weapon.DoAttack(target.gameObject, ai.aiPawn); } else if (!movement.DoMovement) { doPathCalculation = true; } if (doPathCalculation) { SetPathingToTarget(); } }