Beispiel #1
0
        protected override void Update(GameTime gameTime)
        {
            keyboardState = keyboardManager.GetState();
            mouseState    = mouseManager.GetState();

            // Handle base.Update
            base.Update(gameTime);

            //Update game objects
            lightsource.Update(gameTime);
            model.Update(gameTime, lightsource.getLightDirection());
            water.Update(gameTime, lightsource.getLightDirection());
            camera.Update(gameTime);

            //Enable/disable cursor control of the camera
            if (keyboardState.IsKeyPressed(Keys.Space))
            {
                if (enableCursor == true)
                {
                    enableCursor = false;
                }
                else
                {
                    enableCursor = true;
                }
            }

            //Exit the game
            if (keyboardState.IsKeyDown(Keys.Escape))
            {
                this.Exit();
                this.Dispose();
            }
        }