Terraria.Lighting.Brightness C# (CSharp) Method

Brightness() public static method

public static Brightness ( int x, int y ) : float
x int
y int
return float
        public static float Brightness(int x, int y)
        {
            int index1 = x - Lighting.firstTileX + Lighting.offScreenTiles;
            int index2 = y - Lighting.firstTileY + Lighting.offScreenTiles;
            if (index1 < 0 || index2 < 0 || (index1 >= Main.screenWidth / 16 + Lighting.offScreenTiles * 2 + 10 || index2 >= Main.screenHeight / 16 + Lighting.offScreenTiles * 2 + 10))
                return 0.0f;
            Lighting.LightingState lightingState = Lighting.states[index1][index2];
            return (float)((double)Lighting.brightness * ((double)lightingState.r + (double)lightingState.g + (double)lightingState.b) / 3.0);
        }