本文整理匯總了C#中Pathfinding.Path.Error方法的典型用法代碼示例。如果您正苦於以下問題:C# Path.Error方法的具體用法?C# Path.Error怎麽用?C# Path.Error使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pathfinding.Path
的用法示例。
在下文中一共展示了Path.Error方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: StartPath
/** Puts the Path in queue for calculation.
* The callback specified when constructing the path will be called when the path has been calculated.
* Usually you should use the Seeker component instead of calling this function directly.
*
* \param p The path that should be put in queue for calculation
* \param pushToFront If true, the path will be pushed to the front of the queue, bypassing all waiting paths and making it the next path to be calculated.
* This can be useful if you have a path which you want to prioritize over all others. Be careful to not overuse it though.
* If too many paths are put in the front of the queue often, this can lead to normal paths having to wait a very long time before being calculated.
*/
public static void StartPath (Path p, bool pushToFront = false) {
if (active == null) {
Debug.LogError ("There is no AstarPath object in the scene");
return;
}
if (p.GetState() != PathState.Created) {
throw new System.Exception ("The path has an invalid state. Expected " + PathState.Created + " found " + p.GetState() + "\n" +
"Make sure you are not requesting the same path twice");
}
if (active.pathQueue.IsTerminating) {
p.Error ();
p.LogError ("No new paths are accepted");
return;
}
if (active.graphs == null || active.graphs.Length == 0) {
Debug.LogError ("There are no graphs in the scene");
p.Error ();
p.LogError ("There are no graphs in the scene");
Debug.LogError (p.errorLog);
return;
}
p.Claim (active);
//Will increment to PathQueue
p.AdvanceState (PathState.PathQueue);
if (pushToFront) {
active.pathQueue.PushFront (p);
} else {
active.pathQueue.Push (p);
}
}
示例2: StartPath
/** Puts the Path in queue for calculation.
* The callback specified when constructing the path will be called when the path has been calculated.
* Usually you should use the Seeker component instead of calling this function directly.
*/
public static void StartPath (Path p) {
if (active == null) {
Debug.LogError ("There is no AstarPath object in the scene");
return;
}
if (p.GetState() != PathState.Created) {
throw new System.Exception ("The path has an invalid state. Expected " + PathState.Created + " found " + p.GetState() + "\n" +
"Make sure you are not requesting the same path twice");
}
if (!active.acceptNewPaths) {
p.Error ();
p.LogError ("No new paths are accepted");
//Debug.LogError (p.errorLog);
//p.ReturnPath ();
return;
}
if (active.graphs == null || active.graphs.Length == 0) {
Debug.LogError ("There are no graphs in the scene");
p.Error ();
p.LogError ("There are no graphs in the scene");
Debug.LogError (p.errorLog);
//p.ReturnPath ();
return;
}
/*MultithreadPath p2 = p as MultithreadPath;
if (p2 == null) {
Debug.LogError ("Path Not Set Up For Multithreading");
return;
}*/
p.Claim (active);
lock (pathQueue) {
//Will increment to PathQueue
p.AdvanceState (PathState.PathQueue);
pathQueue.Enqueue (p);
if (doSetQueueState)
pathQueueFlag.Set ();
}
}