Pathfinding.AstarColor.GetAreaColor C# (CSharp) Method

GetAreaColor() public static method

public static GetAreaColor ( int area ) : Color
area int
return UnityEngine.Color
        public static Color GetAreaColor(int area)
        {
            if (AreaColors == null || area >= AreaColors.Length) {
                return Mathfx.IntToColor (area,1F);
            }
            return AreaColors[area];
        }

Usage Example

Ejemplo n.º 1
0
        public virtual Color NodeColor(GraphNode node, PathHandler data)
        {
            Color result = AstarColor.NodeConnection;
            bool  flag   = false;

            if (node == null)
            {
                return(AstarColor.NodeConnection);
            }
            GraphDebugMode debugMode = AstarPath.active.debugMode;

            switch (debugMode)
            {
            case GraphDebugMode.Penalty:
                result = Color.Lerp(AstarColor.ConnectionLowLerp, AstarColor.ConnectionHighLerp, (node.Penalty - AstarPath.active.debugFloor) / (AstarPath.active.debugRoof - AstarPath.active.debugFloor));
                flag   = true;
                goto IL_A9;

            case GraphDebugMode.Connections:
IL_33:
                if (debugMode != GraphDebugMode.Areas)
                {
                    goto IL_A9;
                }
                result = AstarColor.GetAreaColor(node.Area);
                flag   = true;
                goto IL_A9;

            case GraphDebugMode.Tags:
                result = AstarMath.IntToColor((int)node.Tag, 0.5f);
                flag   = true;
                goto IL_A9;
            }
            goto IL_33;
IL_A9:
            if (!flag)
            {
                if (data == null)
                {
                    return(AstarColor.NodeConnection);
                }
                PathNode pathNode = data.GetPathNode(node);
                switch (AstarPath.active.debugMode)
                {
                case GraphDebugMode.G:
                    result = Color.Lerp(AstarColor.ConnectionLowLerp, AstarColor.ConnectionHighLerp, (pathNode.G - AstarPath.active.debugFloor) / (AstarPath.active.debugRoof - AstarPath.active.debugFloor));
                    break;

                case GraphDebugMode.H:
                    result = Color.Lerp(AstarColor.ConnectionLowLerp, AstarColor.ConnectionHighLerp, (pathNode.H - AstarPath.active.debugFloor) / (AstarPath.active.debugRoof - AstarPath.active.debugFloor));
                    break;

                case GraphDebugMode.F:
                    result = Color.Lerp(AstarColor.ConnectionLowLerp, AstarColor.ConnectionHighLerp, (pathNode.F - AstarPath.active.debugFloor) / (AstarPath.active.debugRoof - AstarPath.active.debugFloor));
                    break;
                }
            }
            result.a *= 0.5f;
            return(result);
        }
All Usage Examples Of Pathfinding.AstarColor::GetAreaColor