Ejemplo n.º 1
0
        private void HandleStateChange()
        {
            if (m_NextState == m_State)
            {
                return;
            }

            switch (m_NextState)
            {
            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.OptionsMenu:
                ShowOptionsMenu();
                break;

            case eGameState.HighScoreScreen:
                ShowHighScores();
                break;

            case eGameState.Gameplay:
                SetupGameplay();
                break;

            case eGameState.SongSelection:
                ShowSongs();
                break;

            case eGameState.Edit:
                SetupEdit();
                break;
            }

            m_State = m_NextState;
        }
Ejemplo n.º 2
0
        public void SetupGameplay()
        {
            ClearGameObjects();
            m_UIStack.Clear();
            m_UIGameplay = new UI.UIGameplay(m_Game.Content);
            m_UIStack.Push(m_UIGameplay);

            m_bPaused = false;
            GraphicsManager.Get().ResetProjection();

            m_Timer.RemoveAll();

            //Reset all gameplay variables
            Multiplier = 1;
            Combo      = 0;
            Score      = 0;
            HitNotes   = 0;
            MultMult   = 1;
            Shield     = 0;



            // Set grid dimensions and player movement limit
            GraphicsManager.Get().SetGridDimensions(m_GridWidth, m_GridHeight);

            if (!DanceMode)
            {
                m_Player = new Objects.Player(m_Game);
                SpawnGameObject(m_Player);
                m_Camera.FollowObject = m_Player;
                m_Player.setPlayerMovementLimitations(m_GridWidth / 3.0f, m_GridHeight / 3.0f);
            }

            ParseFile(m_SongFile);


            foreach (Objects.BeatPlane b in m_BeatPlanes.Values)
            {
                RemoveBeatPlane(b);
            }
            m_BeatPlanes.Clear();
            m_CurrentSong = m_Songs[0];

            Health     = m_iHealthMax / 2;
            TotalNotes = 0;

            SetState(eGameState.Gameplay);
            createTestBeatPlanes();

            MediaPlayer.Stop();
            MediaPlayer.IsVisualizationEnabled = true;
            m_CurrentSongAudio = m_Game.Content.Load <Song>(m_SongFile.Replace(".txt", ""));

            m_VisualData = new VisualizationData();
            MediaPlayer.Play(m_CurrentSongAudio);

            m_CurrentBeat = 0.0f;

            // Get the beatplane at the beat
            Objects.BeatPlane beatplaneAtCurrentBeat = (Objects.BeatPlane)m_BeatPlanes[m_CurrentBeat];
            if (beatplaneAtCurrentBeat != null)
            {
                // Set it active
                beatplaneAtCurrentBeat.SetActive(m_CurrentSong, Objects.BeatPlane.TunnelDirection.straight);
            }
        }