UpdateRecursiveG() public method

public UpdateRecursiveG ( Path path, PathNode pathNode, PathHandler handler ) : void
path Path
pathNode PathNode
handler PathHandler
return void
コード例 #1
0
        public override void UpdateRecursiveG(Path path, PathNode pathNode, PathHandler handler)
        {
            handler.heap.Add(pathNode);
            base.UpdateG(path, pathNode);
            LayerGridGraph gridGraph = LevelGridNode.GetGridGraph(base.GraphIndex);

            int[]           neighbourOffsets = gridGraph.neighbourOffsets;
            LevelGridNode[] nodes            = gridGraph.nodes;
            int             nodeInGridIndex  = base.NodeInGridIndex;

            for (int i = 0; i < 4; i++)
            {
                int connectionValue = this.GetConnectionValue(i);
                if (connectionValue != 255)
                {
                    LevelGridNode levelGridNode = nodes[nodeInGridIndex + neighbourOffsets[i] + gridGraph.lastScannedWidth * gridGraph.lastScannedDepth * connectionValue];
                    PathNode      pathNode2     = handler.GetPathNode(levelGridNode);
                    if (pathNode2 != null && pathNode2.parent == pathNode && pathNode2.pathID == handler.PathID)
                    {
                        levelGridNode.UpdateRecursiveG(path, pathNode2, handler);
                    }
                }
            }
            base.UpdateRecursiveG(path, pathNode, handler);
        }