Пример #1
0
 private void HandleBonusMonster()
 {
     if (bonusMonster == null && boss == null && stage != CurrentLevelStage.playerWonStage)
     {
         Random rand = new Random();
         if (rand.Next(1, 1000) == 998)
         {
             bonusMonster = new BonusMonster(game, bonusMonsterTexture, new Vector2(850, 50), new Point(50, 50), 5, new Point(0, 1), new Point(3, 1), new Vector2(5, 5), true, 5, 50);
         }
     }
     else if (bonusMonster != null)
     {
         if (bonusMonster.position.X <= -50)
         {
             bonusMonster = null;
         }
     }
 }
Пример #2
0
        private void CheckForDeadEnemies(GameTime gameTime)
        {
            //Checks if any of the enemies are dead, incase one is, add score, play a death sound, remove the enemy and start the score multiplier.
            for (int i = 0; i < enemyList.Count; i++)
            {
                if (!enemyList[i].alive)
                {
                    //Adds score for the enemy kill.
                    InGameScreen.playerScore += (enemyList[i].scoreAmount * InGameScreen.scoreMultiplier) * (int)InGameScreen.difficulty;
                    //Plays deathsound for enemy and removes it.
                    Sounds.SoundBank.PlayCue("EnemyDeath");
                    enemyList.Remove(enemyList[i]);
                    //An enemy has been killed, start the timer for multiplier X2 and add a kill to the required kill amount.
                    if (!startScoreMultiplierTimer)
                    {
                        startScoreMultiplierTimer = true;
                    }
                    killsInScoreMultiplierChance += 1;
                }
                else
                {
                    enemyList[i].Update(gameTime, game.Window.ClientBounds);
                }
            }

            //Checks if the bonus monster exists and if his flag is set to dead, if this is ture, reward the player and remove him.
            if (bonusMonster != null && !bonusMonster.alive)
            {
                InGameScreen.playerScore += (bonusMonster.scoreAmount * InGameScreen.scoreMultiplier) * (int)InGameScreen.difficulty;
                Sounds.SoundBank.PlayCue("EnemyDeath");

                bonusMonster = null;
            }
        }