Example #1
0
        /**
         * Gravitates the color towards (1,1,1, world.ambientLight)
         * Rate is determined by the property decay
         */
        protected virtual void performDecay()
        {
            //Color decay toward 1
            if (color.getBrightness() != 1f)
            {
                color += -1f;
                color *= decay;
                if (Math.Abs(color.getBrightness()) < 0.00005f)
                {
                    color = new Color(0, color.a);
                }
                color += 1f;
            }

            //Intensity decay toward ambience
            color.a -= world.ambientLight;
            color.a *= decay;
            if (color.a < 0.00005f)
            {
                color.a = 0;
            }
            color.a += world.ambientLight;
        }