update() static private method

static private update ( float dt ) : void
dt float
return void
Exemplo n.º 1
0
        protected override void Update(GameTime gameTime)
        {
            if (pauseOnFocusLost && !IsActive)
            {
                SuppressDraw();
                return;
            }

                        #if DEBUG
            TimeRuler.instance.startFrame();
            TimeRuler.instance.beginMark("update", Color.Green);
                        #endif

            // update all our systems
            Time.update((float)gameTime.ElapsedGameTime.TotalSeconds);
            Input.update();
            RenderTarget.instance.update();
            _coroutineManager.update();
            _tweenManager.update();
            _timerManager.update();

            if (exitOnEscapeKeypress && Input.isKeyDown(Keys.Escape) || Input.gamePads[0].isButtonReleased(Buttons.Back))
            {
                Exit();
                return;
            }

            if (_scene != null)
            {
                _scene.update();
            }

            if (_scene != _nextScene)
            {
                if (_scene != null)
                {
                    _scene.end();
                }

                _scene = _nextScene;
                onSceneChanged();

                if (_scene != null)
                {
                    _scene.begin();
                }
            }

                        #if DEBUG
            TimeRuler.instance.endMark("update");
            DebugConsole.instance.update();
                        #endif
        }
Exemplo n.º 2
0
        protected override void Update(GameTime gameTime)
        {
            if (pauseOnFocusLost && !IsActive)
            {
                SuppressDraw();
                return;
            }

                        #if DEBUG
            TimeRuler.instance.startFrame();
            TimeRuler.instance.beginMark("update", Color.Green);
                        #endif

            // update all our systems and global managers
            Time.update((float)gameTime.ElapsedGameTime.TotalSeconds);
            Input.update();

            for (var i = _globalManagers.length - 1; i >= 0; i--)
            {
                _globalManagers.buffer[i].update();
            }

            if (exitOnEscapeKeypress && (Input.isKeyDown(Keys.Escape) || Input.gamePads[0].isButtonReleased(Buttons.Back)))
            {
                Exit();
                return;
            }

            if (_scene != null)
            {
                _scene.update();
            }

            if (_scene != _nextScene)
            {
                if (_scene != null)
                {
                    _scene.end();
                }

                _scene = _nextScene;
                onSceneChanged();

                if (_scene != null)
                {
                    _scene.begin();
                }
            }

                        #if DEBUG
            TimeRuler.instance.endMark("update");
            DebugConsole.instance.update();
            drawCalls = 0;
                        #endif

                        #if FNA
            // MonoGame only updates old-school XNA Components in Update which we dont care about. FNA's core FrameworkDispatcher needs
            // Update called though so we do so here.
            FrameworkDispatcher.Update();
                        #endif
        }