示例#1
0
        // Called once every frame.
        protected override void Update(GameTime gameTime)
        {
            // Shift+Esc will close the game.
            if ((Keyboard.GetState().IsKeyDown(Keys.LeftShift) || Keyboard.GetState().IsKeyDown(Keys.RightShift)) &&
                Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                GlobalServices.ExitGame();
            }

            if (Keyboard.GetState().IsKeyDown(Keys.F11))
            {
                if (!level.IsActive())
                {
                    ChangeScene(1);
                    ((Scenes.Level)level).SetDebugMode();
                }
                else if (!((Scenes.Level)level).DebugMode)
                {
                    ((Scenes.Level)level).SetDebugMode();
                }
            }


            GlobalServices.Update(gameTime);

            root.Update();          // Update main components.
            root.Update("control"); // Update control components.
            root.Update("motion");  // Update motion components.

            base.Update(gameTime);
        }