本文整理汇总了C#中FastList.Reverse方法的典型用法代码示例。如果您正苦于以下问题:C# FastList.Reverse方法的具体用法?C# FastList.Reverse怎么用?C# FastList.Reverse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FastList
的用法示例。
在下文中一共展示了FastList.Reverse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindPath
//.........这里部分代码省略.........
retX = (steep ? y : x);
retY = (steep ? x : y);
if (GridManager.Grid [retX * GridManager.NodeCount + retY].Unwalkable) {
break;
} else if (x == x1) {
OutputPath.FastClear ();
OutputPath.Add (startNode);
OutputPath.Add (endNode);
return true;
}
error = error - dy;
if (error < 0) {
y += ystep;
error += dx;
}
}
#endregion
}
GridHeap.FastClear ();
GridClosedSet.FastClear ();
#endregion
#region AStar Algorithm
GridHeap.Add (startNode);
GridNode.HeuristicTargetX = endNode.gridX;
GridNode.HeuristicTargetY = endNode.gridY;
while (GridHeap.Count > 0) {
currentNode = GridHeap.RemoveFirst ();
GridClosedSet.Add (currentNode);
if (currentNode.gridIndex == endNode.gridIndex) {
OutputPath.FastClear ();
//Retraces the path then outputs it into OutputPath
//Also Simplifies the path
oldNode = endNode;
currentNode = endNode.parent;
oldX = int.MaxValue;
oldY = int.MaxValue;
StartNodeIndex = startNode.gridIndex;
//if (!endNode.Obstructed) OutputPath.Add (endNode);
while (oldNode.gridIndex != StartNodeIndex) {
newX = currentNode.gridX - oldNode.gridX;
newY = currentNode.gridY - oldNode.gridY;
if ((newX != oldX || newY != oldY))
{
OutputPath.Add (oldNode);
oldX = newX;
oldY = newY;
}
oldNode = currentNode;
currentNode = currentNode.parent;
}
OutputPath.Add (startNode);
OutputPath.Reverse ();
return true;
}
for (i = 0; i < 8; i++) {
neighbor = currentNode.NeighborNodes [i];
if (neighbor == null|| neighbor.Unwalkable || GridClosedSet.Contains (neighbor)) {
continue;
}
newMovementCostToNeighbor = currentNode.gCost + (currentNode.NeighborDiagnal [i] ? 141 : 100);
if (!GridHeap.Contains (neighbor)) {
neighbor.gCost = newMovementCostToNeighbor;
//Optimized heuristic calculation
neighbor.CalculateHeurustic ();
neighbor.parent = currentNode;
GridHeap.Add (neighbor);
} else if (newMovementCostToNeighbor < neighbor.gCost) {
neighbor.gCost = newMovementCostToNeighbor;
//Optimized heuristic calculation
neighbor.CalculateHeurustic ();
neighbor.parent = currentNode;
GridHeap.UpdateItem (neighbor);
}
}
}
#endregion
return false;
}