예제 #1
0
    private void RecalculateDebugLimits()
    {
        this.debugFloor = float.PositiveInfinity;
        this.debugRoof  = float.NegativeInfinity;
        bool ignoreSearchTree = !this.showSearchTree || this.debugPathData == null;

        for (int i = 0; i < this.graphs.Length; i++)
        {
            if (this.graphs[i] != null && this.graphs[i].drawGizmos)
            {
                this.graphs[i].GetNodes(delegate(GraphNode node)
                {
                    if (ignoreSearchTree || GraphGizmoHelper.InSearchTree(node, this.debugPathData, this.debugPathID))
                    {
                        if (this.debugMode == GraphDebugMode.Penalty)
                        {
                            this.debugFloor = Mathf.Min(this.debugFloor, node.Penalty);
                            this.debugRoof  = Mathf.Max(this.debugRoof, node.Penalty);
                        }
                        else if (this.debugPathData != null)
                        {
                            PathNode pathNode             = this.debugPathData.GetPathNode(node);
                            GraphDebugMode graphDebugMode = this.debugMode;
                            if (graphDebugMode != GraphDebugMode.F)
                            {
                                if (graphDebugMode != GraphDebugMode.G)
                                {
                                    if (graphDebugMode == GraphDebugMode.H)
                                    {
                                        this.debugFloor = Mathf.Min(this.debugFloor, pathNode.H);
                                        this.debugRoof  = Mathf.Max(this.debugRoof, pathNode.H);
                                    }
                                }
                                else
                                {
                                    this.debugFloor = Mathf.Min(this.debugFloor, pathNode.G);
                                    this.debugRoof  = Mathf.Max(this.debugRoof, pathNode.G);
                                }
                            }
                            else
                            {
                                this.debugFloor = Mathf.Min(this.debugFloor, pathNode.F);
                                this.debugRoof  = Mathf.Max(this.debugRoof, pathNode.F);
                            }
                        }
                    }
                });
            }
        }
        if (float.IsInfinity(this.debugFloor))
        {
            this.debugFloor = 0f;
            this.debugRoof  = 1f;
        }
        if (this.debugRoof - this.debugFloor < 1f)
        {
            this.debugRoof += 1f;
        }
    }
예제 #2
0
    private void RecalculateDebugLimits()
    {
        this.debugFloor = float.PositiveInfinity;
        this.debugRoof  = float.NegativeInfinity;
        bool ignoreSearchTree = !this.showSearchTree || this.debugPathData == null;

        Action <GraphNode> < > 9__0;
        for (int i = 0; i < this.graphs.Length; i++)
        {
            if (this.graphs[i] != null && this.graphs[i].drawGizmos)
            {
                NavGraph           navGraph = this.graphs[i];
                Action <GraphNode> action;
                if ((action = < > 9__0) == null)
                {
                    action = (< > 9__0 = delegate(GraphNode node)
                    {
                        if (ignoreSearchTree || GraphGizmoHelper.InSearchTree(node, this.debugPathData, this.debugPathID))
                        {
                            if (this.debugMode == GraphDebugMode.Penalty)
                            {
                                this.debugFloor = Mathf.Min(this.debugFloor, node.Penalty);
                                this.debugRoof = Mathf.Max(this.debugRoof, node.Penalty);
                                return;
                            }
                            if (this.debugPathData != null)
                            {
                                PathNode pathNode = this.debugPathData.GetPathNode(node);
                                switch (this.debugMode)
                                {
                                case GraphDebugMode.G:
                                    this.debugFloor = Mathf.Min(this.debugFloor, pathNode.G);
                                    this.debugRoof = Mathf.Max(this.debugRoof, pathNode.G);
                                    return;

                                case GraphDebugMode.H:
                                    this.debugFloor = Mathf.Min(this.debugFloor, pathNode.H);
                                    this.debugRoof = Mathf.Max(this.debugRoof, pathNode.H);
                                    break;

                                case GraphDebugMode.F:
                                    this.debugFloor = Mathf.Min(this.debugFloor, pathNode.F);
                                    this.debugRoof = Mathf.Max(this.debugRoof, pathNode.F);
                                    return;

                                default:
                                    return;
                                }
                            }
                        }
                    });
                }
                navGraph.GetNodes(action);
            }
        }
        if (float.IsInfinity(this.debugFloor))
        {
            this.debugFloor = 0f;
            this.debugRoof  = 1f;
        }
        if (this.debugRoof - this.debugFloor < 1f)
        {
            this.debugRoof += 1f;
        }
    }