public void test()
    {
        for (int j = 0; j < playerInventory.Length; j++)
        {
            if (playerInventory[j].gameObject.transform.childCount == 0)
            {
                Transform panel = playerInventory[j].transform;

                GameObject      a    = Instantiate(defaultPotion);
                potionAttribute test = a.AddComponent <potionAttribute>();
                a.GetComponent <UnityEngine.UI.Image>().sprite = potions["Potion of Healing"].img;
                a.name = potions["Potion of Healing"].ingredientName;
                test.setAttribute("Rejuvenation");
                a.transform.SetParent(panel.transform, false);

                Transform panel2 = playerInventory[j + 1].transform;

                GameObject          b     = Instantiate(defaultIngredient);
                ingredientAttribute test2 = b.AddComponent <ingredientAttribute>();
                test2 = ingredients["Torched Perunika"];
                b.GetComponent <UnityEngine.UI.Image>().sprite = test2.img;
                b.name = test2.ingredientName;
                b.transform.SetParent(panel2.transform, false);

                Transform panel3 = playerInventory[j + 2].transform;

                GameObject          c     = Instantiate(defaultIngredient);
                ingredientAttribute test3 = c.AddComponent <ingredientAttribute>();
                test3 = ingredients["Ethereal Billberry"];
                c.GetComponent <UnityEngine.UI.Image>().sprite = test3.img;
                c.name = test3.ingredientName;
                c.transform.SetParent(panel3.transform, false);

                Transform panel4 = playerInventory[j + 3].transform;

                GameObject      d     = Instantiate(defaultPotion);
                potionAttribute test4 = d.AddComponent <potionAttribute>();
                d.GetComponent <UnityEngine.UI.Image>().sprite = potions["Decoction of Clarity"].img;
                d.name = potions["Decoction of Clarity"].ingredientName;
                test4.setAttribute("Awakening");
                d.transform.SetParent(panel4.transform, false);

                Transform panel5 = playerInventory[j + 4].transform;

                GameObject      e     = Instantiate(defaultPotion);
                potionAttribute test5 = e.AddComponent <potionAttribute>();
                e.GetComponent <UnityEngine.UI.Image>().sprite = potions["Brew of Blessing"].img;
                e.name = potions["Brew of Blessing"].ingredientName;
                test5.setAttribute("Awakening");
                e.transform.SetParent(panel5.transform, false);
                break;
            }
        }
    }
    void addPotion(string s, string att)
    {
        for (int j = 0; j < playerInventory.Length; j++)
        {
            if (playerInventory[j].gameObject.transform.childCount == 0)
            {
                Transform panel = playerInventory[j].transform;

                GameObject      a    = Instantiate(defaultPotion);
                potionAttribute test = a.AddComponent <potionAttribute>();
                a.GetComponent <UnityEngine.UI.Image>().sprite = potions[s].img;
                a.name = potions[s].ingredientName;
                test.setAttribute(att);
                a.transform.SetParent(panel.transform, false);
                player.modalPopUp(potions[s].ingredientName, test.attribute, a.GetComponent <UnityEngine.UI.Image>().sprite);
                for (int h = 0; h < m_slots.Length; h++)
                {
                    if (m_slots[h] != null)
                    {
                        Destroy(m_slots[h]);
                    }
                }
                bool added = false;
                for (int k = 0; k < recipePages.transform.childCount; k++)
                {
                    if (recipePages.transform.GetChild(k).transform.FindChild("title").GetComponent <Text>().text != s)
                    {
                        added = false;
                    }
                    else
                    {
                        added = true;
                        k     = recipePages.transform.childCount - 1;
                    }
                }
                if (!added)
                {
                    addRecipePage(s);
                }

                bubbles.Play();
                break;
            }
        }
    }
Beispiel #3
0
    public void test()
    {
        for (int j = 0; j < playerInventory.Length; j++)
        {
            if (playerInventory[j].gameObject.transform.childCount == 0)
            {
                Transform panel = playerInventory[j].transform;

                GameObject      a    = Instantiate(defaultPotion);
                potionAttribute test = a.AddComponent <potionAttribute>();
                a.GetComponent <UnityEngine.UI.Image>().sprite = potions["Potion of Healing"].img;
                a.name = potions["Silver Water"].ingredientName;
                test.setAttribute("Awakening");
                a.transform.SetParent(panel.transform, false);

                Transform panel2 = playerInventory[j + 1].transform;

                GameObject          b     = Instantiate(defaultIngredient);
                ingredientAttribute test2 = b.AddComponent <ingredientAttribute>();
                test2 = ingredients["Torched Perunika"];
                b.GetComponent <UnityEngine.UI.Image>().sprite = test2.img;
                b.name = test2.ingredientName;
                b.transform.SetParent(panel2.transform, false);

                Transform panel3 = playerInventory[j + 2].transform;

                GameObject          c     = Instantiate(defaultIngredient);
                ingredientAttribute test3 = c.AddComponent <ingredientAttribute>();
                test3 = ingredients["Dwarf Billberry"];
                c.GetComponent <UnityEngine.UI.Image>().sprite = test3.img;
                c.name = test3.ingredientName;
                c.transform.SetParent(panel3.transform, false);

                break;
            }
        }
    }