예제 #1
0
파일: Engine.cs 프로젝트: xposure/Worm
        protected override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            Reload();

            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            if (Keyboard.GetState().IsKeyDown(Keys.F12))
            {
                _shouldReload = true;
            }

            if (_shouldReload && Keyboard.GetState().IsKeyUp(Keys.F12))
            {
                _shouldReload = false;
                _logger.LogDebug("LoadScene");
                _gee?.LoadScene();
            }

            var dt = (float)gameTime.ElapsedGameTime.TotalSeconds;

            updateTimer.Restart();

            _services.Tick(dt);

            _gee?.Update(dt);

            updateTimer.Stop();
            _updateAvg += updateTimer;
        }