/// <summary>  
 /// Creates a new instance of the SpriteFontFloatScore class, copying from the source.  
 /// </summary>  
 /// <param name="copySource">The source SpriteFontFloatScore to copy from.</param>  
 internal SpriteFontFloatScore(SpriteFontFloatScore copySource)
 {
     this.Score = copySource.Score;
     this.Position = copySource.Position;
     this.Alive = copySource.Alive;
     this.SpriteFont = copySource.SpriteFont;
     this.Color = copySource.Color;
     this.EndPosition = copySource.EndPosition;
     this.StartPosition = copySource.StartPosition;
     this.LifeSpan = copySource.LifeSpan;
     this.LifeLeft = copySource.LifeLeft;
     this.SizeTime = copySource.SizeTime;
     this.SizeTimeLeft = copySource.SizeTimeLeft;
     this.Spawn3DCoordinates = copySource.Spawn3DCoordinates;
     this.Scale = copySource.Scale;
     this.RotationDegrees = copySource.RotationDegrees;
     this.LayerDepth = copySource.LayerDepth;
     this.ShadowEffect = copySource.ShadowEffect;
     this.ColorChange = copySource.ColorChange;
 }
 /// <summary>  
 /// Creates a set of floating scores, copying from the source scores.  
 /// </summary>  
 /// <param name="copySource">Collection of SpriteFontFloatScore(s) to replicate.</param>  
 internal SpriteFontFloatScores(SpriteFontFloatScores copySource)
     : this()
 {
     foreach (AstroFlare.SpriteFontFloatScore entry in copySource)
     {
         AstroFlare.SpriteFontFloatScore newEntry = new AstroFlare.SpriteFontFloatScore(entry);
         this.Add(newEntry);
     }
 }
        public static void AddFloatingScore(SpriteFontFloatScores floatingScores, int Score, Vector2 Position, Color color, float colorChange)
        {
            //string strScore = "";

            SpriteFontFloatScore floatScore = new SpriteFontFloatScore();
            floatScore.SpriteFont = floatingScoreFont;
            floatScore.LifeSpan = 1500;
            floatScore.Color = color;
            floatScore.Alive = true;
            floatScore.ShadowEffect = false;
            floatScore.EndPosition = new Vector2(20, -20);
            floatScore.SizeTime = 500;
            floatScore.StartPosition = Position;
            floatScore.LayerDepth = 0.7f;
            floatScore.ColorChange = colorChange;

            //floatScore.Spawn3DCoordinates = Position;

            //if (Score > 0)
            //{
            //    strScore += "+ ";
            //    floatScore.Color = Color.Yellow;
            //}
            //else
            //{
            //    strScore += "- ";
            //    floatScore.Color = Color.Red;
            //}
            //strScore += Math.Abs(Score).ToString();

            //floatScore.Score = strScore;
            floatScore.Score = "+" + Score;

            floatingScores.Add(floatScore);
        }
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void Activate(bool instancePreserved)
        {
            if (!instancePreserved)
            {
                if (content == null)
                    content = new ContentManager(ScreenManager.Game.Services, "Content");

                //Example message box for error display
                //List<string> MBOPTIONS = new List<string>();
                //MBOPTIONS.Add("OK");
                //string msg = "Text that was typed on the keyboard will be displayed here.\nClick OK to continue...";
                //Guide.BeginShowMessageBox("Pause", msg, MBOPTIONS, 0, MessageBoxIcon.Alert, null, null);

                // if memory leak, try using a new content manager and unloading.
                //ContentManager levelContent = new ContentManager(services, "Content");

                //extensions.initialise_texture(ScreenManager.SpriteBatch);
                Config.timeDropChance = 200;

                Config.shieldDropChance = 8 + (int)Math.Round(((float)8 / 100) * Config.PowerupDropChance);

                Config.projectileDropChance = 38 + (int)Math.Round(((float)38 / 100) * Config.PowerupDropChance);
                Config.missileDropChance = 68 + (int)Math.Round(((float)68 / 100) * Config.PowerupDropChance);
                Config.firerateDropChance = 128 + (int)Math.Round(((float)128 / 100) * Config.PowerupDropChance);
                Config.laserDropChance = 188 + (int)Math.Round(((float)158 / 100) * Config.PowerupDropChance);

                //Config.projectileDropChance = 68 + (int)Math.Round(((float)38 / 100) * Config.PowerupDropChance);
                //Config.missileDropChance = 98 + (int)Math.Round(((float)68 / 100) * Config.PowerupDropChance);
                //Config.firerateDropChance = 158 + (int)Math.Round(((float)128 / 100) * Config.PowerupDropChance);
                //Config.laserDropChance = 218 + (int)Math.Round(((float)158 / 100) * Config.PowerupDropChance);

                multiplierTracker = 2;
                Config.KillStreak = 0;
                Config.KillStreakBuildpoints = 0;
                Config.Score = 0;
                Config.Multi = 1;
                Config.AIScore = 0;
                Config.AIMulti = 1;
                Config.EmemiesKilled = 0;
                Config.CoinsCollected = 0;
                Config.EnemySpeed = 6;
                playerLives = Config.PlayerLives;

                playerAbilityUses = Config.PlayerSpecialAbilityUses;

                KillStreakBarBackground = new Bar(200, 20, new Color(0, 0, 0, 128));
                KillStreakBarBackground.Position = new Vector2(300, 455);
                KillStreakBarBackground.Percent = 1f;

                KillStreakBar = new Bar(200, 20, new Color(0,128,0,128));
                KillStreakBar.Position = new Vector2(300, 455);


                laserCharges = "0";

                thumbstick = content.Load<Texture2D>("thumbstick2");
                //introExtermination = content.Load<Texture2D>(@"Gamescreens\AlterEgo");
                phaserTexture = content.Load<Texture2D>(@"phaser");

                levelTimeColorInterval = new Timer();
                levelTimeColorInterval.Fire += new NotifyHandler(levelTimeColorInterval_Fire);

                switch (Config.Level)
                {
                    case LevelSelect.One:
                        stars = content.Load<Texture2D>(@"Background\Stars3");
                        backgroundClouds2 = content.Load<Texture2D>(@"Background\BackgroundClouds2");
                        musicLevel1 = content.Load<Song>(@"Music\throughthestars");
                        musicLevel1 = content.Load<Song>(@"Music\throughthestars");
                        levelTime = 300;
                        break;
                    case LevelSelect.Two:
                        stars = content.Load<Texture2D>(@"Background\Stars2");
                        //backgroundClouds2 = content.Load<Texture2D>(@"Background\cloudlayer2");
                        backgroundClouds2 = content.Load<Texture2D>(@"Background\BackgroundClouds2");
                        musicLevel1 = content.Load<Song>(@"Music\galacticstruggle");
                        levelTime = 300;
                        levelTimeColor = Color.Green;
                        break;
                    case LevelSelect.Three:
                        //stars = content.Load<Texture2D>(@"Background\stars");
                        //backgroundClouds2 = content.Load<Texture2D>(@"Background\nova2");
                        //backgroundClouds1 = content.Load<Texture2D>(@"Background\stars4");
                        stars = content.Load<Texture2D>(@"Background\Stars8");
                        backgroundClouds2 = content.Load<Texture2D>(@"Background\stars7");
                        backgroundClouds1 = content.Load<Texture2D>(@"Background\cloudlayer2");
                        musicLevel1 = content.Load<Song>(@"Music\survival");
                        levelTime = 300;
                        playerLives = 3;
                        respawnTime = TimeSpan.FromSeconds(5);
                        break;
                    case LevelSelect.Four:
                        stars = content.Load<Texture2D>(@"Background\stars");
                        backgroundClouds2 = content.Load<Texture2D>(@"Background\stars10");
                        backgroundClouds1 = content.Load<Texture2D>(@"Background\stars7");
                        musicLevel1 = content.Load<Song>(@"Music\holo");
                        levelTime = 300;
                        playerLives = 3;
                        respawnTime = TimeSpan.FromSeconds(5);
                        break;
                    case LevelSelect.Five:
                        //stars = content.Load<Texture2D>(@"Background\Stars5");
                        //backgroundClouds2 = content.Load<Texture2D>(@"Background\Stars4");
                        //backgroundClouds1 = content.Load<Texture2D>(@"Background\cloudlayer2");
                        stars = content.Load<Texture2D>(@"Background\Stars5");
                        backgroundClouds2 = content.Load<Texture2D>(@"Background\Stars4");
                        backgroundClouds1 = content.Load<Texture2D>(@"Background\stars7");
                        musicLevel1 = content.Load<Song>(@"Music\giantrobotsfighting");
                        levelTime = 60;
                        break;
                    case LevelSelect.Six:
                        stars = content.Load<Texture2D>(@"Background\stars");
                        backgroundClouds2 = content.Load<Texture2D>(@"Background\nova2");
                        backgroundClouds1 = content.Load<Texture2D>(@"Background\stars4");
                        musicLevel1 = content.Load<Song>(@"Music\AgainstTheOdds");
                        levelTime = 300;
                        break;
                    case LevelSelect.Practise:
                        //UIdescription = content.Load<Texture2D>(@"Gamescreens\UIdescription");
                        stars = content.Load<Texture2D>(@"Background\Stars3");
                        backgroundClouds2 = content.Load<Texture2D>(@"Background\BackgroundClouds2");
                        musicLevel1 = content.Load<Song>(@"Music\throughthestars");
                        levelTime = 300;
                        break;
                }

                font = content.Load<SpriteFont>(@"Fonts\Tahoma14");
                floatingScoreFont = content.Load<SpriteFont>(@"Fonts\Andy22");
                floatingPowerupFont = content.Load<SpriteFont>(@"Fonts\Andy22");
                floatingMultiplierMsgFont = content.Load<SpriteFont>(@"Fonts\Andy48");
                andy14 = content.Load<SpriteFont>(@"Fonts\Andy14");
                andy18 = content.Load<SpriteFont>(@"Fonts\Andy18");
                andy22 = content.Load<SpriteFont>(@"Fonts\Andy22");
                andy48 = content.Load<SpriteFont>(@"Fonts\Andy48");

                SpriteSheet.LoadContent(content, ScreenManager.GraphicsDevice);

                cam = new Camera2D(ScreenManager.GraphicsDevice, worldBounds.Right, worldBounds.Bottom);

                //GameStateManagementGame.Instance.soundManager.LoadSound("Shot3", @"SoundEffects\Shot3");
                //GameStateManagementGame.Instance.soundManager.LoadSound("coin", @"SoundEffects\coin");
                //GameStateManagementGame.Instance.soundManager.LoadSound("ShipSpawn", @"SoundEffects\ShipSpawn");
                //GameStateManagementGame.Instance.soundManager.LoadSound("ShipExplode", @"SoundEffects\ShipExplode");

                Player.SpawnShip();

                //Player = new Player();
                switch (Config.Level)
                {
                    case LevelSelect.One:
                        level1 = new Level1();
                        break;
                    case LevelSelect.Two:
                        level2 = new Level2();
                        break;
                    case LevelSelect.Three:
                        level3 = new Level3();
                        Player.SpawnEnemyShip();
                        break;
                    case LevelSelect.Four:
                        level4 = new Level4();
                        Player.SpawnEnemyShip();
                        break;
                    case LevelSelect.Five:
                        level5 = new Level5();
                        break;
                    case LevelSelect.Six:
                        level6 = new Level6();
                        break;
                    case LevelSelect.Practise:
                        practise = new Practise();
                        break;
                }
                //bud = new BuddyMissile(Config.BuddySpriteSheet);
                //bud.Position = Player.Ship.Position;

                //if (Player.Ship == null)
                //{
                //    Player.SpawnShip();
                //}
                //ParticleEngineEffect = new ParticleEffects(graphicsDeviceManager, cam, GraphicsDevice);
                ParticleEffects.Initialize(ScreenManager.GraphicsDeviceManager, ScreenManager.GraphicsDevice);
                //ParticleEngineEffect.LoadContent(content);
                ParticleEffects.LoadContent(content);

                FloatingScoreList = new SpriteFontFloatScores();

                //FloatingScore = new SpriteFontFloatScore();

                //FloatingScore.Color = Color.Green;
                //FloatingScore.Score = "+";
                //FloatingScore.SpriteFont = floatingScoreFont;
                //FloatingScore.LifeSpan = 1000f;
                //FloatingScore.SizeTime = 500f;
                //FloatingScore.ShadowEffect = false;
                //FloatingScore.EndPosition = new Vector2(20, -20);

                FloatingPowerupText = new SpriteFontFloatScore();

                FloatingPowerupText.Color = Color.White;
                FloatingPowerupText.Score = "+";
                FloatingPowerupText.SpriteFont = floatingPowerupFont;
                FloatingPowerupText.LifeSpan = 1000f;
                FloatingPowerupText.SizeTime = 500f;
                FloatingPowerupText.ShadowEffect = false;
                FloatingPowerupText.EndPosition = new Vector2(20, -20);
                FloatingPowerupText.LayerDepth = 0.7f;

                FloatingMultiplierText = new SpriteFontFloatScore();

                FloatingMultiplierText.Color = Color.White;
                FloatingMultiplierText.Score = "Multiplyer";
                FloatingMultiplierText.SpriteFont = floatingMultiplierMsgFont;
                FloatingMultiplierText.LifeSpan = 1000f;
                FloatingMultiplierText.SizeTime = 500f;
                FloatingMultiplierText.ShadowEffect = true;
                FloatingMultiplierText.EndPosition = Vector2.Zero;
                FloatingPowerupText.LayerDepth = 1.0f;

                //if (queueBullet.queue.Count < 1)
                //{
                //    for (int i = 0; i < 100; i++)
                //    {

                //        queueBullet.queue.Enqueue(new queueBullet(Config.BulletSheetEnergyPurple));
                //    }
                //}
                if (Config.MusicOn && MediaPlayer.GameHasControl)
                    GameStateManagementGame.Instance.musicManager.Play(musicLevel1);

                //GameStateManagementGame.Instance.musicManager.Stop();

                Bar.Texture = content.Load<Texture2D>("Textures/Fill22");

                multiHud = new Sprite(Config.MultiHud);
                multiHud.Scale = 0.5f;
                multiHud.Color = Color.Green;
                multi = (Math.Round(Config.Multi, 2)).ToString() + "x";

                healthHud = new Sprite(Config.MultiHud);
                healthHud.Scale = 0.3f;
                healthHud.Color = Color.Red;

                shieldHud = new Sprite(Config.MultiHud);
                shieldHud.Scale = 0.5f;
                shieldHud.Color = Color.RoyalBlue;

                AImultiHud = new Sprite(Config.MultiHud);
                AImultiHud.Scale = 0.5f;
                AImultiHud.Color = Color.Green;
                AImulti = (Math.Round(Config.AIMulti, 2)).ToString() + "x";

                AIHealthHud = new Sprite(Config.MultiHud);
                AIHealthHud.Scale = 0.3f;
                AIHealthHud.Color = Color.Red;

                AIShieldHud = new Sprite(Config.MultiHud);
                AIShieldHud.Scale = 0.5f;
                AIShieldHud.Color = Color.RoyalBlue;



                GC.Collect();


                // once the load has finished, we use ResetElapsedTime to tell the game's
                // timing mechanism that we have just finished a very long frame, and that
                // it should not try to catch up.
                ScreenManager.Game.ResetElapsedTime();
            }

//#if WINDOWS_PHONE
//            if (Microsoft.Phone.Shell.PhoneApplicationService.Current.State.ContainsKey("PlayerPosition"))
//            {
//                playerPosition = (Vector2)Microsoft.Phone.Shell.PhoneApplicationService.Current.State["PlayerPosition"];
//                enemyPosition = (Vector2)Microsoft.Phone.Shell.PhoneApplicationService.Current.State["EnemyPosition"];
//            }
//#endif
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // Set the sharing mode of the graphics device to turn on XNA rendering
            SharedGraphicsDeviceManager.Current.GraphicsDevice.SetSharingMode(true);

            //MainPage.myGame.GameManager.SinglePlayerTools.StartPractice(null);
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(SharedGraphicsDeviceManager.Current.GraphicsDevice);

            Config.timeDropChance = 200;

            Config.shieldDropChance = 8 + (int)Math.Round(((float)8 / 100) * Config.PowerupDropChance);

            Config.projectileDropChance = 38 + (int)Math.Round(((float)38 / 100) * Config.PowerupDropChance);
            Config.missileDropChance = 68 + (int)Math.Round(((float)68 / 100) * Config.PowerupDropChance);
            Config.firerateDropChance = 128 + (int)Math.Round(((float)128 / 100) * Config.PowerupDropChance);
            Config.laserDropChance = 188 + (int)Math.Round(((float)158 / 100) * Config.PowerupDropChance);

            //Config.projectileDropChance = 68 + (int)Math.Round(((float)38 / 100) * Config.PowerupDropChance);
            //Config.missileDropChance = 98 + (int)Math.Round(((float)68 / 100) * Config.PowerupDropChance);
            //Config.firerateDropChance = 158 + (int)Math.Round(((float)128 / 100) * Config.PowerupDropChance);
            //Config.laserDropChance = 218 + (int)Math.Round(((float)158 / 100) * Config.PowerupDropChance);

            Config.CoinsCollected = 0;
            multiplierTracker = 2;
            Config.KillStreak = 0;
            Config.KillStreakBuildpoints = 0;
            Config.Score = 0;
            Config.Multi = 1;
            Config.AIScore = 0;
            Config.AIMulti = 1;
            Config.EmemiesKilled = 0;
            Config.CoinsCollected = 0;
            Config.EnemySpeed = 6;
            playerLives = Config.PlayerLives;

            playerAbilityUses = Config.PlayerSpecialAbilityUses;
            if (Config.boostPrepared > 0)
            {
                playerAbilityUses++;
                Config.boostPrepared--;
            }

            if (Config.boostShieldsUp > 0)
            {
                boostShieldsUpActive = true;
            }

            if (Config.boostLastStand > 0)
            {
                boostLastStandActive = true;
            }

            KillStreakBarBackground = new Bar(200, 20, new Color(0, 0, 0, 128));
            KillStreakBarBackground.Position = new Vector2(300, 455);
            KillStreakBarBackground.Percent = 1f;

            KillStreakBar = new Bar(200, 20, new Color(0, 128, 0, 128));
            KillStreakBar.Position = new Vector2(300, 455);


            laserCharges = "0";

            thumbstick = contentManager.Load<Texture2D>("thumbstick2");

            //thumbstick = content.Load<Texture2D>("thumbstick2");
            //introExtermination = content.Load<Texture2D>(@"Gamescreens\AlterEgo");
            phaserTexture = contentManager.Load<Texture2D>(@"phaser");

            levelTimeColorInterval = new Timer();
            levelTimeColorInterval.Fire += new NotifyHandler(levelTimeColorInterval_Fire);

            switch (Config.Level)
            {
                case LevelSelect.One:
                    stars = contentManager.Load<Texture2D>(@"Background\Stars3");
                    backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\BackgroundClouds2");
                    //musicLevel1 = contentManager.Load<Song>(@"Music\throughthestars");
                    //musicLevel1 = contentManager.Load<Song>(@"Music\throughthestars");
                    levelTime = 300;
                    (Application.Current as App).TryPlayBackgroundMusic(1);
                    break;
                case LevelSelect.Two:
                    stars = contentManager.Load<Texture2D>(@"Background\Stars2");
                    //backgroundClouds2 = content.Load<Texture2D>(@"Background\cloudlayer2");
                    backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\BackgroundClouds2");
                    //musicLevel1 = contentManager.Load<Song>(@"Music\galacticstruggle");
                    levelTime = 300;
                    levelTimeColor = Color.Green;
                    (Application.Current as App).TryPlayBackgroundMusic(2);
                    break;
                case LevelSelect.Three:
                    //stars = content.Load<Texture2D>(@"Background\stars");
                    //backgroundClouds2 = content.Load<Texture2D>(@"Background\nova2");
                    //backgroundClouds1 = content.Load<Texture2D>(@"Background\stars4");
                    stars = contentManager.Load<Texture2D>(@"Background\Stars8");
                    backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\stars7");
                    backgroundClouds1 = contentManager.Load<Texture2D>(@"Background\cloudlayer2");
                    //musicLevel1 = contentManager.Load<Song>(@"Music\survival");
                    levelTime = 300;
                    playerLives = 3;
                    respawnTime = TimeSpan.FromSeconds(5);
                    (Application.Current as App).TryPlayBackgroundMusic(3);
                    break;
                case LevelSelect.Four:
                    stars = contentManager.Load<Texture2D>(@"Background\stars");
                    backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\stars10");
                    backgroundClouds1 = contentManager.Load<Texture2D>(@"Background\stars7");
                    //musicLevel1 = contentManager.Load<Song>(@"Music\holo");
                    levelTime = 300;
                    playerLives = 3;
                    respawnTime = TimeSpan.FromSeconds(5);
                    (Application.Current as App).TryPlayBackgroundMusic(4);
                    break;
                case LevelSelect.Five:
                    //stars = content.Load<Texture2D>(@"Background\Stars5");
                    //backgroundClouds2 = content.Load<Texture2D>(@"Background\Stars4");
                    //backgroundClouds1 = content.Load<Texture2D>(@"Background\cloudlayer2");
                    stars = contentManager.Load<Texture2D>(@"Background\Stars5");
                    backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\Stars4");
                    backgroundClouds1 = contentManager.Load<Texture2D>(@"Background\stars7");
                    //musicLevel1 = contentManager.Load<Song>(@"Music\giantrobotsfighting");
                    levelTime = 60;
                    (Application.Current as App).TryPlayBackgroundMusic(5);
                    break;
                case LevelSelect.Six:
                    stars = contentManager.Load<Texture2D>(@"Background\stars");
                    backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\nova2");
                    backgroundClouds1 = contentManager.Load<Texture2D>(@"Background\stars4");
                    //musicLevel1 = contentManager.Load<Song>(@"Music\AgainstTheOdds");
                    levelTime = 300;
                    (Application.Current as App).TryPlayBackgroundMusic(6);
                    break;
                case LevelSelect.Practise:
                    //UIdescription = content.Load<Texture2D>(@"Gamescreens\UIdescription");
                    stars = contentManager.Load<Texture2D>(@"Background\Stars3");
                    backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\BackgroundClouds2");
                    //musicLevel1 = contentManager.Load<Song>(@"Music\throughthestars");
                    levelTime = 300;
                    (Application.Current as App).TryPlayBackgroundMusic(1);
                    break;
            }

            font = contentManager.Load<SpriteFont>(@"Fonts\Tahoma14");
            floatingScoreFont = contentManager.Load<SpriteFont>(@"Fonts\Andy22");
            floatingPowerupFont = contentManager.Load<SpriteFont>(@"Fonts\Andy22");
            floatingMultiplierMsgFont = contentManager.Load<SpriteFont>(@"Fonts\Andy48");
            andy14 = contentManager.Load<SpriteFont>(@"Fonts\Andy14");
            andy18 = contentManager.Load<SpriteFont>(@"Fonts\Andy18");
            andy22 = contentManager.Load<SpriteFont>(@"Fonts\Andy22");
            andy48 = contentManager.Load<SpriteFont>(@"Fonts\Andy48");

            SpriteSheet.LoadContent(contentManager, SharedGraphicsDeviceManager.Current.GraphicsDevice);

            cam = new Camera2D(SharedGraphicsDeviceManager.Current.GraphicsDevice, worldBounds.Right, worldBounds.Bottom);

            //GameStateManagementGame.Instance.soundManager.LoadSound("Shot3", @"SoundEffects\Shot3");
            //GameStateManagementGame.Instance.soundManager.LoadSound("coin", @"SoundEffects\coin");
            //GameStateManagementGame.Instance.soundManager.LoadSound("ShipSpawn", @"SoundEffects\ShipSpawn");
            //GameStateManagementGame.Instance.soundManager.LoadSound("ShipExplode", @"SoundEffects\ShipExplode");

            Player.SpawnShip();

            //Player = new Player();
            switch (Config.Level)
            {
                case LevelSelect.One:
                    level1 = new Level1();
                    break;
                case LevelSelect.Two:
                    level2 = new Level2();
                    break;
                case LevelSelect.Three:
                    level3 = new Level3();
                    Player.SpawnEnemyShip();
                    break;
                case LevelSelect.Four:
                    level4 = new Level4();
                    Player.SpawnEnemyShip();
                    break;
                case LevelSelect.Five:
                    level5 = new Level5();
                    break;
                case LevelSelect.Six:
                    level6 = new Level6();
                    break;
                case LevelSelect.Practise:
                    practise = new Practise();
                    break;
            }
            //bud = new BuddyMissile(Config.BuddySpriteSheet);
            //bud.Position = Player.Ship.Position;

            //if (Player.Ship == null)
            //{
            //    Player.SpawnShip();
            //}
            //ParticleEngineEffect = new ParticleEffects(graphicsDeviceManager, cam, GraphicsDevice);
            ParticleEffects.Initialize(SharedGraphicsDeviceManager.Current, SharedGraphicsDeviceManager.Current.GraphicsDevice);
            //ParticleEngineEffect.LoadContent(content);
            ParticleEffects.LoadContent(contentManager);

            FloatingScoreList = new SpriteFontFloatScores();

            //FloatingScore = new SpriteFontFloatScore();

            //FloatingScore.Color = Color.Green;
            //FloatingScore.Score = "+";
            //FloatingScore.SpriteFont = floatingScoreFont;
            //FloatingScore.LifeSpan = 1000f;
            //FloatingScore.SizeTime = 500f;
            //FloatingScore.ShadowEffect = false;
            //FloatingScore.EndPosition = new Vector2(20, -20);

            FloatingPowerupText = new SpriteFontFloatScore();

            FloatingPowerupText.Color = Color.White;
            FloatingPowerupText.Score = "+";
            FloatingPowerupText.SpriteFont = floatingPowerupFont;
            FloatingPowerupText.LifeSpan = 1000f;
            FloatingPowerupText.SizeTime = 500f;
            FloatingPowerupText.ShadowEffect = false;
            FloatingPowerupText.EndPosition = new Vector2(20, -20);
            FloatingPowerupText.LayerDepth = 0.7f;

            FloatingMultiplierText = new SpriteFontFloatScore();

            FloatingMultiplierText.Color = Color.Green;
            FloatingMultiplierText.Score = "Multiplyer";
            FloatingMultiplierText.SpriteFont = floatingMultiplierMsgFont;
            FloatingMultiplierText.LifeSpan = 1000f;
            FloatingMultiplierText.SizeTime = 500f;
            FloatingMultiplierText.ShadowEffect = true;
            FloatingMultiplierText.EndPosition = Vector2.Zero;
            FloatingPowerupText.LayerDepth = 1.0f;

            //if (queueBullet.queue.Count < 1)
            //{
            //    for (int i = 0; i < 100; i++)
            //    {

            //        queueBullet.queue.Enqueue(new queueBullet(Config.BulletSheetEnergyPurple));
            //    }
            //}
            //if (Config.MusicOn && MediaPlayer.GameHasControl)
            //    GameStateManagementGame.Instance.musicManager.Play(musicLevel1);

            //GameStateManagementGame.Instance.musicManager.Stop();

            Bar.Texture = contentManager.Load<Texture2D>("Textures/Fill22");

            multiHud = new Sprite(Config.MultiHud);
            multiHud.Scale = 0.5f;
            multiHud.Color = Color.Green;
            multi = (Math.Round(Config.Multi, 2)).ToString() + "x";

            healthHud = new Sprite(Config.MultiHud);
            healthHud.Scale = 0.3f;
            healthHud.Color = Color.Red;

            shieldHud = new Sprite(Config.MultiHud);
            shieldHud.Scale = 0.5f;
            shieldHud.Color = Color.RoyalBlue;

            AImultiHud = new Sprite(Config.MultiHud);
            AImultiHud.Scale = 0.5f;
            AImultiHud.Color = Color.Green;
            AImulti = (Math.Round(Config.AIMulti, 2)).ToString() + "x";

            AIHealthHud = new Sprite(Config.MultiHud);
            AIHealthHud.Scale = 0.3f;
            AIHealthHud.Color = Color.Red;

            AIShieldHud = new Sprite(Config.MultiHud);
            AIShieldHud.Scale = 0.5f;
            AIShieldHud.Color = Color.RoyalBlue;



            GC.Collect();


            // once the load has finished, we use ResetElapsedTime to tell the game's
            // timing mechanism that we have just finished a very long frame, and that
            // it should not try to catch up.
            //ScreenManager.Game.ResetElapsedTime();

            // Start the timer
            timer.Start();

            if (Config.ControlOption == 3)
                AccelerometerHelper.Instance.Active = true;

            PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;

            base.OnNavigatedTo(e);
        }