void Start() { PotionSelectionScript = GameObject.Find("Brewing_GUI").GetComponent <PotionSelection> (); Brewing.gameObject.SetActive(false); PotionObtained = true; CurrentPotionCopy = PotionSelectionScript.CurrentPotion; RequestComplete = false; Portal.gameObject.SetActive(false); GeneralStore.gameObject.SetActive(false); brewStat = GameObject.Find("Brewing_Station").GetComponent <OpenBrewingGUI>(); }
public void CheckIngredient() { PotionSelectionScript = GameObject.Find("Brewing_GUI").GetComponent <PotionSelection> (); Debug.Log("Checking Potion"); List <IngredientItem> IngredientInventoryThrowAway = new List <IngredientItem>(); // IngredientInventoryThrowAway.Clear (); //IngredientInventoryThrowAway = IngredientInventory; for (int i = 0; i < IngredientInventory.Count; i++) { IngredientInventoryThrowAway.Add(IngredientInventory [i]); } int Ingredients = 0; for (int a = 0; a < PotionSelectionScript.RecipeIngredients.Count; a++) { for (int b = 0; b < IngredientInventoryThrowAway.Count; b++) { if (IngredientInventoryThrowAway[b].IngredientID == PotionSelectionScript.RecipeIngredients[a].IngredientID) { IngredientInventoryThrowAway.RemoveAt(b); Ingredients++; } if (Ingredients == PotionSelectionScript.RecipeIngredients.Count) { break; } } } Debug.Log(Ingredients.ToString()); if (Ingredients == PotionSelectionScript.RecipeIngredients.Count) { //Instantiate(EndResult); //AddPotion(); for (int a = 0; a < PotionSelectionScript.RecipeIngredients.Count; a++) { if (PotionSelectionScript.RecipeIngredients.Count >= 1) { RemoveIngredient(0); } if (PotionSelectionScript.RecipeIngredients.Count >= 2) { RemoveIngredient(1); } if (PotionSelectionScript.RecipeIngredients.Count >= 3) { RemoveIngredient(2); } if (PotionSelectionScript.RecipeIngredients.Count >= 4) { RemoveIngredient(3); } if (PotionSelectionScript.RecipeIngredients.Count >= 5) { RemoveIngredient(4); } if (Ingredients == PotionSelectionScript.RecipeIngredients.Count) { break; } } PotionBrewing = true; PotionObtained = false; Instantiate(ProgressBar); checkPotion = Instantiate(CheckPotion); checkPotion.name = "CheckPotion"; brewStat.CheckPotion = checkPotion; Debug.Log("Potion has been brewed"); } if (Ingredients < PotionSelectionScript.RecipeIngredients.Count) { MentorText.text = "You don't have the ingredeints to make that potion right now!"; Debug.Log("Potion couldn't be made"); } }