本文整理汇总了C#中GridCell.getCell方法的典型用法代码示例。如果您正苦于以下问题:C# GridCell.getCell方法的具体用法?C# GridCell.getCell怎么用?C# GridCell.getCell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GridCell
的用法示例。
在下文中一共展示了GridCell.getCell方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: findPath
public void findPath(GridCell startCell, GridCell goalCell, GridCell[,,] grid)
{
this.grid = grid;
gridWidth = grid.GetLength(0);
gridHeight = grid.GetLength(1);
gridDepth = grid.GetLength(2);
start = new Node(startCell.getCell()[0], startCell.getCell()[1], startCell.getCell()[2], 0, 0, 0, null, startCell);
end = new Node(goalCell.getCell()[0], goalCell.getCell()[1], goalCell.getCell()[2], 0, 0, 0, null, goalCell);
openList.Add(start);
bool keepSearching = true;
bool pathExists = true;
while (keepSearching && pathExists) {
Node curNode = getBestFromOpenList();
if (curNode == null) {
pathExists = false;
break;
}
closeList.Add(curNode);
if (nodeIsGoal(curNode)) {
keepSearching = false;
} else {
findValidNeighbors(curNode);
foreach (Node n in neighbors) {
if (findInCloseList(n) != null) {
continue;
}
Node inOpenList = findInOpenList(n);
if (inOpenList == null) {
openList.Add(n);
} else {
if (n.G < inOpenList.G) {
inOpenList.G = n.G;
inOpenList.F = inOpenList.G + inOpenList.H;
inOpenList.parent = curNode;
}
}
}
}
}
if (pathExists) {
Node n = findInCloseList(end);
while (n != null) {
finalPath.Add(n);
n = n.parent;
}
}
}