Objects.Song createTestSong()
        {
            Objects.Song returnSong = new Objects.Song();
            returnSong.BPM = 120f;

            Random randomNoteGenerator = new Random();

            // Create random notes
            for (float i = 1f; i < 600f; i += randomNoteGenerator.Next(1, 3))
            {
                Objects.Note newNote = new Objects.Note(m_Game);
                newNote.Location = new Point(randomNoteGenerator.Next(-1, 2), randomNoteGenerator.Next(-1, 2));
                returnSong.AddNote(i, newNote);
                SpawnGameObject(newNote);
                m_Notes.Add(newNote);
            }

            return(returnSong);
        }
        public void ParseFile(string filename)
        {
            Objects.Song song = new Objects.Song();
            string       path = Path.Combine(Directory.GetCurrentDirectory(), "Content", filename);
            string       line;
            StreamReader sr           = new StreamReader(path);
            bool         gameElements = false;

            while ((line = sr.ReadLine()) != null)
            {
                if (gameElements)
                {
                    Objects.Note note = new Objects.Note(m_Game);
                    note.Beat = float.Parse(line.Remove(line.IndexOf(",")));
                    line      = line.Substring(line.IndexOf(",") + 2);
                    string type = line.Remove(line.IndexOf(","));
                    if (type.Equals("Bad"))
                    {
                        note.SetBad(true);
                        note.NotePowerup = Objects.Note.Powerup.None;
                    }
                    else
                    {
                        note.SetBad(false);
                        if (type.Equals("Good"))
                        {
                            note.NotePowerup = Objects.Note.Powerup.None;
                        }
                        else
                        {
                            note.SetPowerup(type);
                        }
                    }
                    if (type.Equals("Good") || type.Equals("Bad"))
                    {
                        line       = line.Substring(line.IndexOf(",") + 2);
                        note.Value = int.Parse(line.Remove(line.IndexOf(",")));
                    }
                    else
                    {
                        note.Value = 0;
                    }
                    line = line.Substring(line.IndexOf(",") + 2);
                    note.IntToLocation(int.Parse(line));

                    song.AddNote(note.Beat, note);
                    SpawnGameObject(note);
                    m_Notes.Add(note);
                }

                if (line.StartsWith("#"))
                {
                    if (line.Contains("GameElements"))
                    {
                        gameElements = true;
                    }
                    continue;
                }
                else if (line.StartsWith("Name:"))
                {
                    song.Name = line.Remove(0, 6);
                }
                else if (line.StartsWith("Artist:"))
                {
                    song.Artist = line.Remove(0, 8);
                }
                else if (line.StartsWith("Mode:"))
                {
                    string mode = line.Remove(0, 6);
                    if (mode.Equals("Dance"))
                    {
                        song.DanceMode = true;
                    }
                    else
                    {
                        song.DanceMode = false;
                    }
                }
                else if (line.StartsWith("Difficulty:"))
                {
                    song.Difficulty = int.Parse(line.Remove(0, 12));
                }
                else if (line.StartsWith("BPM:"))
                {
                    song.BPM = float.Parse(line.Remove(0, 5));
                }
                else if (line.StartsWith("SongLength:"))
                {
                    song.Length = float.Parse(line.Remove(0, 12));
                }
                else if (line.StartsWith("LeadIn:"))
                {
                    song.LeadIn = float.Parse(line.Remove(0, 8));
                }
                else if (line.StartsWith("BeatsPerMeasure:"))
                {
                    song.BeatsPerMeasure = int.Parse(line.Remove(0, 17));
                }
                else if (line.StartsWith("AppearanceTime:"))
                {
                    song.AppearanceTime = float.Parse(line.Remove(0, 16));
                }
            }

            m_Songs.Clear();
            m_Songs.Add(song);
            sr.Close();
        }
        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);
            }
        }