Пример #1
0
    private void RecalculateDebugLimits()
    {
        this.debugFloor = float.PositiveInfinity;
        this.debugRoof  = float.NegativeInfinity;
        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 (!this.showSearchTree || this.debugPathData == null || NavGraph.InSearchTree(node, this.debugPath))
                    {
                        PathNode pathNode = (this.debugPathData == null) ? null : this.debugPathData.GetPathNode(node);
                        if (pathNode != null || this.debugMode == GraphDebugMode.Penalty)
                        {
                            switch (this.debugMode)
                            {
                            case GraphDebugMode.G:
                                this.debugFloor = Mathf.Min(this.debugFloor, pathNode.G);
                                this.debugRoof  = Mathf.Max(this.debugRoof, pathNode.G);
                                break;

                            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);
                                break;

                            case GraphDebugMode.Penalty:
                                this.debugFloor = Mathf.Min(this.debugFloor, node.Penalty);
                                this.debugRoof  = Mathf.Max(this.debugRoof, node.Penalty);
                                break;
                            }
                        }
                    }
                    return(true);
                });
            }
        }
        if (float.IsInfinity(this.debugFloor))
        {
            this.debugFloor = 0f;
            this.debugRoof  = 1f;
        }
        if (this.debugRoof - this.debugFloor < 1f)
        {
            this.debugRoof += 1f;
        }
    }