当前位置: 首页>>代码示例>>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;未经允许,请勿转载。