Ejemplo n.º 1
0
        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            // TODO: Add your update code here

            base.Update(gameTime);
            timer.Update(gameTime);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            // TODO: Add your update code here
            if (!PauseMenuScreen.IsPaused)
            {
                timer.Update(gameTime);

                float timeDelta = (float)gameTime.ElapsedGameTime.Ticks / System.TimeSpan.TicksPerMillisecond / 1000;


                if (bPhysicsDriven)
                {
                    m_velocity   += vAcceleration * timeDelta / 2.0f;
                    m_position   += m_velocity * timeDelta;
                    vAcceleration = vForce / fMass;
                    m_velocity   += vAcceleration * timeDelta / 2.0f;

                    if (m_velocity.Length() > fTerminalVelocity)
                    {
                        m_velocity *= fTerminalVelocity / m_velocity.Length();
                    }
                }
                else
                {
                    //do it the previous way
                    //add velocity to position
                    this.position += m_velocity * timeDelta * SPEED_UP;
                }

                //rotate around axis
                this.quat *= Quaternion.CreateFromAxisAngle(rotationAxis, rotationVelocity * timeDelta);

                // for all actors in the game
                //worldBoarder();

                //Cel Shading
                //Set the light direction to a fixed value.
                //This will place the light source behind, to the right, and above the user.
                diffuseLightDirection = new Vector3(1, 1, 0);
                //ensure the light direction is normalized, or
                //the shader will give some weird results
                //diffuseLightDirection.Normalize();

                //set the color of the diffuse light
                diffuseLightColor = Color.White.ToVector4();

                //The built-in camera class provides the view matrix
                //view = camera.ViewMatrix;
                view = hostScreen.CameraMatrix;

                //eyePosition = camera.Position;
                eyePosition = hostScreen.GetCameraPosition();
                //LightPosition = new Vector3(50, 50, 50);
                //LightPosition.Normalize();


                base.Update(gameTime);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Updates the state of the game. This method checks the GameScreen.IsActive
        /// property, so the game will stop updating when the pause menu is active,
        /// or if you tab away to a different application.
        /// </summary>
        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
                                    bool coveredByOtherScreen)
        {
            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);

            if (IsActive)
            {
                m_kTimer.Update(gameTime);
            }
        }
Ejemplo n.º 4
0
        public override void Update(GameTime gameTime)
        {
            missileTimer.Update(gameTime);

            base.Update(gameTime);
        }