InSearchTree() 공개 메소드

public InSearchTree ( GraphNode node, Path path ) : bool
node GraphNode
path Path
리턴 bool
예제 #1
0
        public virtual void OnDrawGizmos(bool drawNodes)
        {
            if (!drawNodes)
            {
                return;
            }
            PathHandler       data = AstarPath.active.debugPathData;
            GraphNode         node = null;
            GraphNodeDelegate del  = delegate(GraphNode o)
            {
                Gizmos.DrawLine((Vector3)node.position, (Vector3)o.position);
            };

            this.GetNodes(delegate(GraphNode _node)
            {
                node         = _node;
                Gizmos.color = this.NodeColor(node, AstarPath.active.debugPathData);
                if (AstarPath.active.showSearchTree && !NavGraph.InSearchTree(node, AstarPath.active.debugPath))
                {
                    return(true);
                }
                PathNode pathNode = (data == null) ? null : data.GetPathNode(node);
                if (AstarPath.active.showSearchTree && pathNode != null && pathNode.parent != null)
                {
                    Gizmos.DrawLine((Vector3)node.position, (Vector3)pathNode.parent.node.position);
                }
                else
                {
                    node.GetConnections(del);
                }
                return(true);
            });
        }
예제 #2
0
        public override void OnDrawGizmos(bool drawNodes)
        {
            if (!drawNodes)
            {
                return;
            }
            base.OnDrawGizmos(false);
            if (this.nodes == null)
            {
                return;
            }
            PathHandler debugPathData = AstarPath.active.debugPathData;

            for (int i = 0; i < this.nodes.Length; i++)
            {
                LevelGridNode levelGridNode = this.nodes[i];
                if (levelGridNode != null && levelGridNode.Walkable)
                {
                    Gizmos.color = this.NodeColor(levelGridNode, AstarPath.active.debugPathData);
                    if (AstarPath.active.showSearchTree && AstarPath.active.debugPathData != null)
                    {
                        if (NavGraph.InSearchTree(levelGridNode, AstarPath.active.debugPath))
                        {
                            PathNode pathNode = debugPathData.GetPathNode(levelGridNode);
                            if (pathNode != null && pathNode.parent != null)
                            {
                                Gizmos.DrawLine((Vector3)levelGridNode.position, (Vector3)pathNode.parent.node.position);
                            }
                        }
                    }
                    else
                    {
                        for (int j = 0; j < 4; j++)
                        {
                            int connectionValue = levelGridNode.GetConnectionValue(j);
                            if (connectionValue != 255)
                            {
                                int num = levelGridNode.NodeInGridIndex + this.neighbourOffsets[j] + this.width * this.depth * connectionValue;
                                if (num >= 0 && num < this.nodes.Length)
                                {
                                    GraphNode graphNode = this.nodes[num];
                                    if (graphNode != null)
                                    {
                                        Gizmos.DrawLine((Vector3)levelGridNode.position, (Vector3)graphNode.position);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }