コード例 #1
0
        protected override void ProcessChildNode(NodeRecord parentNode, NavigationGraphEdge connectionEdge, int connectionIndex)
        {
            TotalEdges++;
            NodeGoalBounds goalBound = GoalBoundingTable.table[parentNode.node.NodeIndex];

            if (goalBound != null && connectionIndex < goalBound.connectionBounds.Length)
            {
                DataStructures.GoalBounding.Bounds bound = goalBound.connectionBounds[connectionIndex];
                if (bound.PositionInsideBounds(GoalNode.Position))
                {
                    base.ProcessChildNode(parentNode, connectionEdge, connectionIndex);
                    return;
                }
            }
            else
            {
                base.ProcessChildNode(parentNode, connectionEdge, connectionIndex);
                return;
            }

            DiscardedEdges++;
            return;
        }
コード例 #2
0
        protected override void ProcessChildNode(NodeRecord parentNode, NavigationGraphEdge connectionEdge, int edgeIndex)
        {
            //TODO: Implement this method for the GoalBoundingPathfinding to Work. If you implemented the NodeArrayAStar properly, you wont need to change the search method.
            //Fetching index of GoalBoundingTable
            int            index      = parentNode.node.NodeIndex;
            NodeGoalBounds nodeBounds = GoalBoundingTable.table[index];

            if (nodeBounds == null) //Special check for some nodes that have null nodeBounds.
            {
                base.ProcessChildNode(parentNode, connectionEdge, edgeIndex);
            }
            if (nodeBounds != null && nodeBounds.connectionBounds.Length > edgeIndex) // Special check for when bounds are not available for the node even if it exists.
            {
                //Obtain the parent bound corresponding to the edgeIndex of the child.
                DataStructures.GoalBounding.Bounds b = nodeBounds.connectionBounds[edgeIndex];
                if (!b.PositionInsideBounds(GoalPosition))
                {
                    this.DiscardedEdges++;
                    return;
                }
            }
            base.ProcessChildNode(parentNode, connectionEdge, edgeIndex);
        }