コード例 #1
0
        public void Update(GameTime gameTime)
        {
            double r = light.Color.R, g = light.Color.G, b = light.Color.B;

            r = (r + dirR * Math.Max(r * gameTime.ElapsedGameTime.TotalSeconds, 1));
            g = (g + dirG * Math.Max(g * gameTime.ElapsedGameTime.TotalSeconds, 1));
            b = (b + dirB * Math.Max(b * gameTime.ElapsedGameTime.TotalSeconds, 1));

            CutAndSetDir(ref r, ref dirR);
            CutAndSetDir(ref g, ref dirG);
            CutAndSetDir(ref b, ref dirB);

            Color c = light.Color;

            c.R         = (byte)r;
            c.G         = (byte)g;
            c.B         = (byte)b;
            light.Color = c;

            effect.UpdateLightColor(light);
        }