public void TestFactoryCreatesPrototypeItemCorrectly() { Potion prototype = new Potion("TestPotion", 99, 1); prototype.AddComponent(new ConsumableComponent(RPGStatsComponent.StatsEffect.ManaModifier, 15)); potionFactory.AddOrUpdatePrototype(PotionFactory.PotionType.Mana, prototype); Potion newPotion = potionFactory.CreateManaPotion(); Assert.AreEqual(prototype.Name, newPotion.Name); Assert.AreEqual(prototype.Cost, newPotion.Cost); Assert.AreEqual(prototype.GetComponent <ConsumableComponent>().Effect, newPotion.GetComponent <ConsumableComponent>().Effect); Assert.AreEqual(prototype.GetComponent <ConsumableComponent>().Potency, newPotion.GetComponent <ConsumableComponent>().Potency); }
public int AddPotion(Potion potion){ potions.Add(potion); potion.transform.parent = GameObject.Find("Head").transform; potion.GetComponent<Collider>().enabled = false; potion.GetComponent<Rigidbody>().isKinematic = true; potion.transform.localRotation = Quaternion.identity; potion.transform.localPosition = new Vector3(-.16f + 0.032f * (potions.Count-1),.125f + potion.yMod,.37f); potion.transform.localScale = new Vector3(potion.scale, potion.scale, potion.scale); if(potions.Count == 1)potion.transform.localScale *= 1.2f; if(potionsVisible){ potion.transform.localPosition += new Vector3(0f,-0.07f,0f); } return potions.Count; }
public void TestFactoryPrototypeComponentIsNotNull() { Potion prototype = new Potion("TestPotion", 99, 1); prototype.AddComponent(new ConsumableComponent(RPGStatsComponent.StatsEffect.ManaModifier, 15)); potionFactory.AddOrUpdatePrototype(PotionFactory.PotionType.Mana, prototype); Potion newPotion = potionFactory.CreateManaPotion(); Assert.IsNotNull(newPotion.GetComponent <ConsumableComponent>()); }