Example #1
0
 public override void InitializeStageBoss()
 {
     secondBoss = new SecondBoss(game, game.Content.Load<Texture2D>(@"Images/SecondBoss"),
         new Vector2(game.Window.ClientBounds.Width / 2 - 100, 0),
         new Point(200, 200),
         5,
         new Point(0, 0),
         new Point(4, 1),
         new Vector2(2, 2),
         false,
         500
         );
 }
Example #2
0
        public virtual void GameStageHandler()
        {
            //Handles the different stages in a level.
            switch (stage)
            {
                case CurrentLevelStage.enemyStage1:

                    if (!stage1Initialized)
                    {
                        InitializeStage1();
                        stage1Initialized = true;
                    }

                    if (enemyList.Count == 0)
                    {
                        stage = CurrentLevelStage.enemyStage2;
                    }
                    break;
                case CurrentLevelStage.enemyStage2:

                    if (!stage2Initialized)
                    {
                        InitializeStage2();
                        stage2Initialized = true;
                    }

                    if (enemyList.Count == 0)
                    {
                        stage = CurrentLevelStage.enemyStage3;
                    }
                    break;
                case CurrentLevelStage.enemyStage3:

                    if (!stage3Initialized)
                    {
                        InitializeStage3();
                        stage3Initialized = true;
                    }

                    if (enemyList.Count == 0)
                    {
                        stage = CurrentLevelStage.bossStage;
                    }
                    break;
                case CurrentLevelStage.bossStage:

                    //Spawn the boss if there is none
                    if (boss == null && stage != CurrentLevelStage.playerWonStage && !bossStageInitialized)
                    {
                        InitializeStageBoss();
                        bossStageInitialized = true;
                        if (InGameScreen.level == CurrentLevel.level1)
                        {
                            InGameScreen.maxBossLife = boss.Life; //Needed to draw the life bar correctly
                        }
                        else
                            InGameScreen.maxBossLife = secondBoss.Life; //Needed to draw the life bar correctly

                    }

                    //The boss is dead, give score, remove him and show a win screen.
                    if (boss != null && !boss.alive)
                    {
                        //Gives score for the boss kill.
                        Sounds.SoundBank.PlayCue("BossDeath");
                        stage = CurrentLevelStage.playerWonStage;
                        InGameScreen.playerScore += boss.scoreAmount * InGameScreen.scoreMultiplier * (int)InGameScreen.difficulty;
                        boss = null;
                        bullets.Clear();
                        Thread.Sleep(1000);
                    }
                    else if (secondBoss != null && !secondBoss.alive)
                    {
                        //Gives score for the boss kill.
                        Sounds.SoundBank.PlayCue("BossDeath");
                        stage = CurrentLevelStage.playerWonStage;
                        InGameScreen.playerScore += secondBoss.scoreAmount * InGameScreen.scoreMultiplier * (int)InGameScreen.difficulty;
                        secondBoss = null;
                        bullets.Clear();
                        Thread.Sleep(1000);
                    }
                    break;
                case CurrentLevelStage.playerWonStage:
                    if (!saved)
                    {
                        HighScores.SaveHighscoreToFile();
                        saved = true;
                        if (InGameScreen.level == CurrentLevel.level1)
                        {
                            LevelWon();
                        }
                        else
                            WinScreen();

                        InGameScreen.level += 1;
                    }
                    break;
                default:
                    break;
            }
        }