Drought.World.Sun.update C# (CSharp) Метод

update() публичный Метод

public update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
Результат void
        public void update(GameTime gameTime)
        {
            if (enabled)
                if (gameTime.TotalGameTime.TotalMilliseconds > oldTime + step)
                {
                    Vector3 normal = new Vector3(0, position.Z, -position.Y);
                    normal.Normalize();
                    position += normal;

                    if (power == 0)
                    {
                        normal = new Vector3(0, position.Z, -position.Y);
                        normal.Normalize();
                        position += normal;
                    }
                    if (power == 0)
                    {
                        normal = new Vector3(0, position.Z, -position.Y);
                        normal.Normalize();
                        position += normal;
                    }
                    if (power == 0)
                    {
                        normal = new Vector3(0, position.Z, -position.Y);
                        normal.Normalize();
                        position += normal;
                    }
                    if (power == 0)
                    {
                        normal = new Vector3(0, position.Z, -position.Y);
                        normal.Normalize();
                        position += normal;
                    }

                    //Power scaling. Power is clamped to 0  below the vertical and 1 above 30 degrees to the vertical.
                    //Power is lerped between 0 and 30 degrees.
                    float limit = position.Length() * (float)Math.Sin(MathHelper.Pi / 6);
                    power = MathHelper.Clamp(position.Z / limit, 0, 1);

                    //Console.WriteLine("position: {2}\nangle: {0}\npower: {1}\n\n", MathHelper.ToDegrees((float)Math.Asin(position.Z / position.Length())), power, position);

                    oldTime = gameTime.TotalGameTime.TotalMilliseconds;
                }
        }