// Use this for initialization
    void Start()
    {
        foreach (Aspects.Secondary aspect in Enum.GetValues(typeof(Aspects.Secondary)))
        {
            if (aspect == Aspects.Secondary.NONE)
            {
                Potions.instance().add(
                    PrimaryAspects[0],
                    PrimaryAspects[1],
                    PrimaryAspects[2],
                    new MultiSet <Aspects.Secondary>(),
                    Slot,
                    aspect,
                    null);
            }
            else if (aspect == Aspects.Secondary.UNKNOWN || aspect == Aspects.Secondary.BASIC)
            {
                // No op.  Weird special cases
            }
            else
            {
                Effect effect = getEffectForAspect(aspect);
                Potions.instance().add(
                    PrimaryAspects[0],
                    PrimaryAspects[1],
                    PrimaryAspects[2],
                    new MultiSet <Aspects.Secondary>()
                {
                    aspect, aspect, aspect
                },
                    Slot,
                    aspect,
                    effect);

                Potions.instance().add(
                    PrimaryAspects[0],
                    PrimaryAspects[1],
                    PrimaryAspects[2],
                    new MultiSet <Aspects.Secondary>()
                {
                    aspect, aspect
                },
                    Slot,
                    Aspects.Secondary.BASIC,
                    null);
            }
        }

        Destroy(this);
    }
Beispiel #2
0
    public void showPotionsTab()
    {
        foreach (Transform child in gameObject.transform)
        {
            Destroy(child.gameObject);
        }

        foreach (CreatedPotion potion in Potions.instance().getLoggedPotions())
        {
            GameObject potionDisplay;
            MultiSet <Aspects.Secondary> secondaries = potion.getPotion().getSecondaries();
            if (secondaries.Count == 0)
            {
                // Potion has no secondaries
                potionDisplay = Instantiate(lineItemPrefab);
            }
            else
            {
                // Potion has secondaries
                potionDisplay = Instantiate(lineItemWithSecondariesPrefab);

                int i = 0;
                foreach (Aspects.Secondary aspect in secondaries)
                {
                    GameObject icon = potionDisplay.transform.Find("Potion Details/Aspect Icons Secondary/Aspect " + (i + 1)).gameObject;
                    icon.GetComponent <Image>().sprite = Aspects.instance().getNormalSprite(aspect);
                    i++;
                }

                while (i < 3)
                {
                    GameObject icon = potionDisplay.transform.Find("Potion Details/Aspect Icons Secondary/Aspect " + (i + 1)).gameObject;
                    Destroy(icon);
                    i++;
                }
            }

            potionDisplay.transform.SetParent(transform);

            List <IngredientType> ingredients = potion.getIngredients();
            for (int i = 0; i < 3; i++)
            {
                potionDisplay.transform.Find("Ingredient Image " + (i + 1)).gameObject.GetComponent <Image>().sprite = IngredientRenderer.instance().getSprite(ingredients[i]);
            }

            Image bodyPartImage1 = potionDisplay.transform.Find("Potion Details/Potion Image").gameObject.GetComponent <Image>();
            Image bodyPartImage2 = potionDisplay.transform.Find("Potion Details/Potion Image 2").gameObject.GetComponent <Image>();

            bodyPartImage1.sprite = dudPotionSprite;
            bodyPartImage2.gameObject.SetActive(false);

            BodyPart[] parts = potion.getPotion().getAffectedBodyParts();

            if (parts.Length > 0)
            {
                Sprite sprite = PlayerSprites.instance().getSprite(potion.getPotion().getType(), parts[0]);

                // Special cases for wings and tail
                if (sprite == null && parts[0] == BodyPart.WINGS)
                {
                    sprite = noWingsSprite;
                }
                else if (sprite == null && parts[0] == BodyPart.TAIL)
                {
                    sprite = noTailSprite;
                }
                else
                {
                    bodyPartImage1.gameObject.SetActive(sprite != null);
                }

                bodyPartImage1.sprite = sprite;
            }
            if (parts.Length > 1)
            {
                bodyPartImage2.sprite = PlayerSprites.instance().getSprite(potion.getPotion().getType(), parts[1]);
                bodyPartImage2.gameObject.SetActive(bodyPartImage2.sprite != null);
            }

            int j = 1;
            foreach (Aspects.Primary primary in potion.getPotion().getPrimaries())
            {
                potionDisplay.transform.Find("Potion Details/Aspect Icons/Aspect " + j).gameObject.GetComponent <Image>().sprite = Aspects.instance().getNormalSprite(primary);
                j++;
            }

            CreatedPotion potion2 = potion;
            potionDisplay.transform.Find("Remove Button").GetComponent <Button>().onClick.AddListener(() => {
                Potions.instance().removeLoggedPotion(potion2);
                showPotionsTab();
            });
        }
    }
Beispiel #3
0
    private void createPotion(IngredientType one, IngredientType two, IngredientType three)
    {
        Potion potion = Potions.instance().createPotion(one, two, three);

        potion.TriggerEffect();
    }