public IEnumerator IncreaseLife_LivesMustIncreaseInOneUnit() { SceneManager.LoadScene("Level1"); yield return(new WaitForSeconds(1)); LifeSystemController lifeSystemController = GameObject.Find("LifeSystemController").GetComponent <LifeSystemController>(); lifeSystemController.lives = 2; lifeSystemController.IncreaseLife(); Assert.AreEqual(3, lifeSystemController.lives, "Lives should be equals to 3."); }
public IEnumerator DecreaseLife_LivesMustNotChange() { SceneManager.LoadScene("Level1"); yield return(new WaitForSeconds(1)); LifeSystemController lifeSystemController = GameObject.Find("LifeSystemController").GetComponent <LifeSystemController>(); lifeSystemController.lives = 0; lifeSystemController.DecreaseLife(); Assert.AreEqual(0, lifeSystemController.lives, "Lives should be equals to 0."); }
private void Awake() { FoodController = GameObject.Find("FoodController").GetComponent <FoodController>(); DamageSystemController = GameObject.Find("DamageSystemController").GetComponent <DamageSystemController>(); LifeSystemController = GameObject.Find("LifeSystemController").GetComponent <LifeSystemController>(); SoundController = GameObject.Find("SoundController").GetComponent <SoundController>(); GameController = GameObject.Find("GameController").GetComponent <GameController>(); MenuController = GameObject.Find("MenuController").GetComponent <MenuController>(); EnemyController = GameObject.Find("EnemyController").GetComponent <EnemyController>(); foodFactory = GameObject.Find("FoodFactory").GetComponent <FoodFactory>(); lifeFactory = GameObject.Find("LifeFactory").GetComponent <LifeFactory>(); trapFactory = GameObject.Find("TrapFactory").GetComponent <TrapFactory>(); energyCapsuleFactory = GameObject.Find("EnergyCapsuleFactory").GetComponent <EnergyCapsuleFactory>(); rockFactory = GameObject.Find("RockFactory").GetComponent <RockFactory>(); }
public IEnumerator DamageOverOneHundred_LivesMustBeReduced() { SceneManager.LoadScene("Level1"); yield return(new WaitForSeconds(1)); DamageSystemController damageSystemController = GameObject.Find("DamageSystemController").GetComponent <DamageSystemController>(); LifeSystemController lifeSystemController = GameObject.Find("LifeSystemController").GetComponent <LifeSystemController>(); int lives = lifeSystemController.lives; damageSystemController.Damage = 90; damageSystemController.IncreaseDamage(20); Assert.AreEqual(lives - 1, lifeSystemController.lives, "Lives should have been reduced."); Assert.AreEqual(0, damageSystemController.Damage, "The damage should have been reset."); }