Esempio n. 1
0
 /// <summary>
 /// This method sets a formula that must be evaluated before deciding whether the player can progress to the next level. Added by Isaac.
 /// </summary>
 public void ControlLevels()
 {
     if (EnemiesToBeRemoved.Count >= GameLevel.GetFormula())
     {
         GameLevel.IncreaseLevel();   // IA - move the next level if enough enemies have been destroyed
         Food.IncreaseMineralValue(); // IA - Make food more expensive
         Food.IncreaseEnergyValue();  // IA - Make the food conversion to energy less significant.
         EnemiesToBeRemoved.Clear();  // IA - Reset the count of enemies destroyed at each level.
         GetWorld().PutMinerals();    //jeremy - for every new level, new minerals added to game
     }
 }
Esempio n. 2
0
        public void IncreaseLevelTest()
        {
            GameLevel.SetLevel(1);
            GameLevel.IncreaseLevel();             // Increase the level by one.

            Assert.AreEqual(2, GameLevel.GetLevel());

            GameLevel.SetLevel(50);
            GameLevel.IncreaseLevel();
            GameLevel.IncreaseLevel();
            GameLevel.IncreaseLevel();             // Call it three times to get 53.

            Assert.AreEqual(53, GameLevel.GetLevel());
        }
Esempio n. 3
0
        public void IncreaseEnergyValueTest()
        {
            // Reminder => The formula to calculate the energy value is: CurrentEnergyValue + CurrentMineralValue - CurrentGameLevel;

            Food.ResetEnergyValue();           // Set the energy value to the default value of 2.
            Food.ResetMineralValue();          // Default is 1.
            GameLevel.SetLevel(1);             // Level 1.

            // The energy value should be: 2 + 1 - 1 = 2
            // The GetEnergyValue() method returns a double rounded off to 2 decimals.
            Assert.AreEqual(2.00, Food.GetEnergyValue());

            // Increase the game level and test again.
            GameLevel.IncreaseLevel();             // Level 2, now.

            // A level increase changes the mineral value as well (see the IncreaseMineralValueTest() above)
            // The new energy value should be: 2 + 2 - 2 = 1;
            Assert.AreEqual(2.00, Food.GetEnergyValue());
        }