Пример #1
0
        public void SetupGameplay()
        {
            ClearGameObjects();
            m_UIStack.Clear();
            m_UIGameplay = new UI.UIGameplay(m_Game.Content);
            m_UIStack.Push(m_UIGameplay);

            m_bPaused = false;
            m_Speed   = eGameSpeed.Normal;
            m_Camera.ResetCamera();
            GraphicsManager.Get().ResetProjection();
            m_SelectedTile = null;
            m_CurrentTile  = null;

            m_Timer.RemoveAll();

            Money         = Balance.StartingMoney;
            Life          = Balance.StartingLife;
            m_WaveNumber  = 0;
            m_bWaveActive = false;
            SpawnWorld();

            // Start the timer for the first wave
            m_Timer.AddTimer("StartWave", Balance.FirstWaveTime, StartWave, false);
            m_bCanPlayAlarm = true;
        }
Пример #2
0
        private void HandleStateChange()
        {
            if (m_NextState == m_State)
            {
                return;
            }

            switch (m_NextState)
            {
            case eGameState.TitleScreen:
                // Going to the title screen so clear everything
                m_UIStack.Clear();
                m_UIGameplay = null;
                m_Timer.RemoveAll();
                m_UIStack.Push(new UI.UITitleScreen(m_Game.Content));
                break;

            case eGameState.MainMenu:
                m_UIStack.Clear();
                m_UIGameplay = null;
                m_Timer.RemoveAll();
                m_UIStack.Push(new UI.UIMainMenu(m_Game.Content));
                ClearGameObjects();
                break;

            case eGameState.Gameplay:
                SetupGameplay();
                break;
            }

            m_State = m_NextState;
        }