示例#1
0
    public override void _Process(float delta)
    {
        Tuple <Color, Color> colors = DEFAULT_COLORS;
        float weightSum             = DEFAULT_COLOR_WEIGHT;

        foreach (Gas g in atm.GetGases())
        {
            float gAmt = atm.GetGasAmt(g);
            if (gAmt > 0)
            {
                float gWeight = WeightFromAmt(gAmt);
                weightSum += gWeight;
                Tuple <Color, Color> gColors = colorTable[g];
                Color newSkyCol  = colors.Item1.LinearInterpolate(gColors.Item1, gWeight / weightSum);
                Color newGndsCol = colors.Item2.LinearInterpolate(gColors.Item2, gWeight / weightSum);
                colors = Tuple.Create(newSkyCol, newGndsCol);
            }
        }
        Color skyColor           = colors.Item1;
        Color groundColor        = colors.Item2;
        Color skyHorizonColor    = skyColor.LinearInterpolate(groundColor, 0.5f);
        Color groundHorizonColor = skyColor.LinearInterpolate(groundColor, 0.5f);

        sky.SetSkyTopColor(skyColor);
        sky.SetSkyHorizonColor(skyHorizonColor);
        sky.SetGroundHorizonColor(groundHorizonColor);
        sky.SetGroundBottomColor(groundColor);
    }
示例#2
0
    private void setSkyColour()
    {
        Color skyColor           = WARNING_COLOUR_SKY;
        Color groundColor        = WARNING_COLOUR_GROUND;
        Color skyHorizonColor    = skyColor.LinearInterpolate(groundColor, 0.5f);
        Color groundHorizonColor = skyColor.LinearInterpolate(groundColor, 0.5f);

        sky.SetSkyTopColor(skyColor);
        sky.SetSkyHorizonColor(skyHorizonColor);
        sky.SetGroundHorizonColor(groundHorizonColor);
        sky.SetGroundBottomColor(groundColor);
    }