// takes in where the path starts, where the path ends, and send a callback because we're splitting the path calls over several frames // Action<the path, have we started the path> // is static so it can be accessed by calling the Class from anywhere public static void RequestPath(Vector3 pathStart, Vector3 pathEnd, Action <Vector3[], bool> callback) { PathRequest newRequest = new PathRequest(pathStart, pathEnd, callback); instance.pathRequestQueue.Enqueue(newRequest); instance.TryProcessNext(); }
// Method for requesting a path public static void RequestPath(Vector3 pathStart, Vector3 pathEnd, Action <Vector3[], bool> callBack) { PathRequest newRequest = new PathRequest(pathStart, pathEnd, callBack); instance.pathRequestQueue.Enqueue(newRequest); // Add the new request inside of the queue instance.TryProcessNext(); // To see if we are processing a path }
/// <summary> /// Can be used to request a new path from the request manager. Needs a start and an end, as well as a method to be called /// once the path has been found. /// </summary> /// <param name="pathStart">The start of the path</param> /// <param name="pathEnd">The end of the path</param> /// <param name="callback">The method to be called once the path has been found</param> public static void RequestPath(Vector3 pathStart, Vector3 pathEnd, Action <Vector3[], bool> callback, Agent agent) { var newRequest = new PathRequest(pathStart, pathEnd, callback, agent); _instance._pathRequests.Enqueue(newRequest); _instance.TryProcessNext(); }
/// <summary> /// Request a new path. /// Once an attempt to plot a path has been made, successful or not, /// the callback Action is invoked. /// </summary> public static void RequestPath(Vector3 pathStart, Vector3 pathEnd, bool ignoreUnwalkableStartAndEnd, NavAgent2D agent) { PathRequest newRequest = new PathRequest(pathStart, pathEnd, ignoreUnwalkableStartAndEnd, agent); instance.pathRequestQueue.Enqueue(newRequest); instance.TryProcessNext(); }
public static void RequestPath(Vector2 start, Vector2 end, GameObject gameObject, Action <Vector2[], bool> callback) { PathRequest request = new PathRequest(start, end, gameObject, callback); instance._pathRequestQueue.Enqueue(request); instance.TryProcessNext(); }
public static void RequestPath(Vector3 startPosition, Vector3 endPosition, Action <Vector3[], bool> callback) { PathRequest newRequest = new PathRequest(startPosition, endPosition, callback); instance.pathRequestQueue.Enqueue(newRequest); instance.TryProcessNext(); }
public static void RequestPath(Tile StartTile, Tile TargetTile, Action <Tile[], bool> callback) { PathRequest newRequest = new PathRequest(StartTile, TargetTile, callback); instance.pathRequestQueue.Enqueue(newRequest); instance.TryProcessNext(); }
// Need to call this every set number of frames (expensive calculation if done per frame) public static void RequestPath(Vector3 start, Vector3 end, Action <Vector3[], bool> callback) { // Create a new path request PathRequest request = new PathRequest(start, end, callback); // Add the request into the request queue instance.pathRequestQueue.Enqueue(request); instance.TryProcessNext(); }