GrandLarceny.Game.Update C# (CSharp) Method

Update() protected method

protected Update ( GameTime a_gameTime ) : void
a_gameTime Microsoft.Xna.Framework.GameTime
return void
        protected override void Update(GameTime a_gameTime)
        {
            if (!IsActive)
            {
                return;
            }
            KeyboardHandler.setCurrentKeyboard(Keyboard.GetState());
            MouseHandler.setCurrentMouse(Mouse.GetState());
            m_currentGameTime = a_gameTime;
            if (m_nextProgress != null)
            {
                m_progress = m_nextProgress;
                m_nextProgress = null;
            }
            if (m_nextState != null)
            {
                m_currentState = m_nextState;
                AssetFactory.updateState(m_currentState);
                if (!m_currentState.isLoaded())
                {
                    #if DEBUG
                    m_currentState.load();
                    #else
                    try
                    {
                        m_currentState.load();
                    }
                    catch (Exception e)
                    {
                        ErrorLogger.getInstance().writeString("While loading " + m_currentState + " got exception: " + e);
                    }
                    #endif
                }
                m_nextState = null;
            }

            #if DEBUG
            if (m_currentState != null)
            {
                m_currentState.update(a_gameTime);
            }
            #else
            if (m_currentState != null)
            {
                try
                {
                    m_currentState.update(a_gameTime);
                }
                catch (Exception e)
                {
                    //ErrorLogger.getInstance().writeString("While updating " + m_currentState + " got exception: " + e);
                }
            }
            #endif

            if (KeyboardHandler.keyClicked(Keys.F7)) //TODO Alfa/Beta-grej
            {
                m_nextState = new MainMenu();
            }

            MouseHandler.setPreviousMouse();
            KeyboardHandler.setPreviousKeyboard();
            base.Update(a_gameTime);
        }