public static void RequestPath(Vector3 startPoint, float power, float angle, float gravity, Action <Vector3[], bool> callback) { ParabolaPathRequest newRequest = new ParabolaPathRequest(startPoint, power, angle, gravity, callback); instance.pathRequestQueue.Enqueue(newRequest); instance.TryProcessNext(); }
private void TryProcessNext() { if (!isProcessingPath && pathRequestQueue.Count > 0) //處理所有的路徑需求 完成時再次確認 { currentPathRequest = pathRequestQueue.Dequeue(); isProcessingPath = true; pathfinding.StartFindPath(currentPathRequest.startPoint, currentPathRequest.power, currentPathRequest.angle, currentPathRequest.gravity); } }