예제 #1
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();

            switch (_currentGameState)
            {
            case GameStateType.Menu:
                InputsManager.UpdateMenu(gameTime);
                break;

            case GameStateType.Cinematics:
                InputsManager.UpdateCinematic(gameTime);
                break;

            case GameStateType.Game:
                foreach (IUpdater updater in Updaters)
                {
                    updater.Update(gameTime);
                }
                //MapRenderer.Update(TileMap,gameTime);
                break;

            case GameStateType.DeveloperConsole:
                InputsManager.KeyboardInput.GetPressedKeys();
                break;
            }

            sw.Stop();
            _deltaTimeUpdate = (float)sw.Elapsed.TotalSeconds;

            Window.Title = $"Update : {_deltaTimeUpdate} - Draw : {_deltaTimeDraw}";
            base.Update(gameTime);
        }