本文整理汇总了C#中Pathfinding.GraphNode.MustBeEqual方法的典型用法代码示例。如果您正苦于以下问题:C# GraphNode.MustBeEqual方法的具体用法?C# GraphNode.MustBeEqual怎么用?C# GraphNode.MustBeEqual使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pathfinding.GraphNode
的用法示例。
在下文中一共展示了GraphNode.MustBeEqual方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompleteWith
/** Completes the path using the specified target node.
* This method assumes that the node is a target node of the path
* not just any random node.
*/
void CompleteWith (GraphNode node) {
#if !ASTAR_NO_GRID_GRAPH
if (endNode == node) {
// Common case, no grid graph special case has been applied
// Nothing to do
} else {
// See EndPointGridGraphSpecialCase()
var gridNode = node as GridNode;
if (gridNode == null) {
throw new System.Exception("Some path is not cleaning up the flag1 field. This is a bug.");
}
// The grid graph special case has been applied
// The closest point on the node is not yet known
// so we need to calculate it
endPoint = gridNode.ClosestPointOnNode(originalEndPoint);
// This is now our end node
// We didn't know it before, but apparently it was optimal
// to move to this node
endNode = node;
}
#else
// This should always be true unless
// the grid graph special case has been applied
// which can only happen if grid graphs have not
// been stripped out with ASTAR_NO_GRID_GRAPH
node.MustBeEqual(endNode);
#endif
// Mark the path as completed
CompleteState = PathCompleteState.Complete;
}