void TryProcessNext() { if (!isProcessingLongPath && longPathRequestQueue.Count > 0) { currentLongPathRequest = longPathRequestQueue.Dequeue(); isProcessingLongPath = true; longPathNavigation.StartFindPath(currentLongPathRequest.pathStart, currentLongPathRequest.pathTarget, currentLongPathRequest.longPathGrid); } }
public static void RequestLongPath(Vector3 pathStart, Vector3 pathTarget, LongPathGrid longPathGrid, Action<Vector3,Vector3,Vector3[], bool> callback) { LongPathRequest newRequest = new LongPathRequest(pathStart, pathTarget, longPathGrid, callback); instance.longPathRequestQueue.Enqueue(newRequest); instance.TryProcessNext(); }