public static void RequestPath(Vector3 pathStart, Vector3 pathEnd, Action <Vector3[], bool> callback) { PathRequest2 newRequest = new PathRequest2(pathStart, pathEnd, callback); instance.pathRequestQueue.Enqueue(newRequest); instance.TryProcessNext(); }
void TryProcessNext() { if (!isProcessingPath && pathRequestQueue.Count > 0) { currentPathRequest = pathRequestQueue.Dequeue(); isProcessingPath = true; pathfinding.StartFindline(currentPathRequest.pathStart, currentPathRequest.pathEnd); } }