Exemple #1
0
        protected override void Update(GameTime gameTime)
        {
            base.Update(gameTime);


            DeltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

            InputsManager.Update();

            // Scene update
            if (_scene.IsNotNull() && !_scene.Pause)
            {
                _scene.BeforeUpdate();
                _scene.Update();
                _scene.AfterUpdate();
            }

            // Switch to the next scene
            // =TODO=: pass the previous scene as argument to the next
            if (_scene != _nextScene && _nextScene.IsNotNull())
            {
                _scene?.End();

                _scene?.Dispose();

                _scene = _nextScene;

                _scene?.LoadContent();

                _scene?.Begin();
            }

            RenderManager.Update();
        }