public bool GetEngagementPath(ref List <BasePathNode> nodes) { BasePathNode closestToPoint = patrolPath.GetClosestToPoint(base.transform.position); Vector3 normalized = (closestToPoint.transform.position - base.transform.position).normalized; if (Vector3.Dot(base.transform.forward, normalized) > 0f) { nodes.Add(closestToPoint); if (!closestToPoint.straightaway) { return(true); } } return(GetPathToClosestTurnableNode(closestToPoint, base.transform.forward, ref nodes)); }
public bool SetDestination(BasePath path, BasePathNode newTargetNode, float speedFraction) { if (!AI.move) { return(false); } if (!AI.navthink) { return(false); } paused = false; if (!CanUseAStar) { return(false); } if (newTargetNode == targetNode && HasPath) { return(true); } if (ReachedPosition(newTargetNode.transform.position)) { return(true); } BasePathNode closestToPoint = path.GetClosestToPoint(base.transform.position); if (closestToPoint == null || closestToPoint.transform == null) { return(false); } float pathCost; if (AStarPath.FindPath(closestToPoint, newTargetNode, out currentAStarPath, out pathCost)) { currentSpeedFraction = speedFraction; targetNode = newTargetNode; SetCurrentNavigationType(NavigationType.AStar); Destination = newTargetNode.transform.position; return(true); } return(false); }