コード例 #1
0
ファイル: MainGameScene.cs プロジェクト: rumkugel13/StackItUp
        protected override void OnUpdate(GameTime gameTime)
        {
            base.OnUpdate(gameTime);

            if (Kadro.Input.KeyboardInput.OnKeyUp(Keys.Escape) || this.btContinue.OnClick() || GamepadInput.OnButtonUp(Buttons.Back) || btPause.OnClick())
            {
                this.SetPaused(!this.isPaused);
            }

            if (Kadro.Input.KeyboardInput.OnKeyUp(Keys.F1))
            {
                this.debugDraw = !this.debugDraw;
            }

            if (this.isPaused)
            {
                if (this.btRestart.OnClick())
                {
                    SwitchScene <MainGameScene>();
                }

                if (this.btBackToMain.OnClick())
                {
                    SwitchScene <MainMenuScene>();
                }

                return;
            }

            // todo: fix this / make it easier
            this.Camera.Origin = WindowSettings.RenderArea.Center.ToVector2();
            this.Camera.FocusOn(new Vector2(0, -7f * WindowSettings.UnitScale.Y), 1.0f);

            // TODO: game logic here
            float elapsedSeconds = (float)gameTime.ElapsedGameTime.TotalSeconds;

            // input / pre update

            this.gameObjectWorld.Update(elapsedSeconds);

            // post update

            if (this.gameover)
            {
                lbGameOver.SetVisible(true);
                return;
            }

            this.CheckBlockState(elapsedSeconds);
        }