public void Brew() { float holder; potionRequrements requrements = new potionRequrements(); //set the new requrements that will be passed int the factory to the current local values requrements.ratTail = ratTail; requrements.owlEye = owlEye; requrements.lylack = lylack; requrements.sunflower = sunflower; requrements.silver = silver; requrements.gold = gold; IPotion potion = new BasicPotion(); PotionFactory factory = new PotionFactory(); potion = factory.Create(requrements); holder = potion.Create(); CostText.text = holder.ToString(); }
public IPotion Create(potionRequrements requrements) { IPotion potion = new BasicPotion(); //animal parts for (int i = requrements.ratTail; i > 0; i--) { potion = new AddRT(potion); } for (int i = requrements.owlEye; i > 0; i--) { potion = new AddOE(potion); } //flowers for (int i = requrements.lylack; i > 0; i--) { potion = new AddLylack(potion); } for (int i = requrements.sunflower; i > 0; i--) { potion = new AddSun(potion); } //metal for (int i = requrements.silver; i > 0; i--) { potion = new AddSilver(potion); } for (int i = requrements.gold; i > 0; i--) { potion = new AddGold(potion); } return(potion); }
public abstract IPotion Create(potionRequrements requrements);