當前位置: 首頁>>代碼示例>>C#>>正文


C# Path.LogError方法代碼示例

本文整理匯總了C#中Pathfinding.Path.LogError方法的典型用法代碼示例。如果您正苦於以下問題:C# Path.LogError方法的具體用法?C# Path.LogError怎麽用?C# Path.LogError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Pathfinding.Path的用法示例。


在下文中一共展示了Path.LogError方法的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);
		}
	}
開發者ID:JackHR,項目名稱:WaveIncoming,代碼行數:46,代碼來源:AstarPath.cs

示例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 ();
		}
	}
開發者ID:GJL91,項目名稱:Epidemic,代碼行數:49,代碼來源:AstarPath.cs


注:本文中的Pathfinding.Path.LogError方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。