예제 #1
0
    void PickItem(Room r)
    {
        if (canHaveComponents || canHaveHealth || canHaveCharges)
        {
            bool haveItem = false;
            while (!haveItem)
            {
                int itemType = Random.Range(0, 3);
                switch (itemType)
                {
                case 0:
                    if (!canHaveComponents)
                    {
                        continue;
                    }
                    price          = componentPrice;
                    giveItem       = GiveSpellComponent;
                    spellComponent = PlayerInventory.instance.AddComponentToStore();
                    ISpellComponent component = ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent(spellComponent, PlayerInventory.instance.componentsInStore[spellComponent]));
                    itemText.text = component.GetTitle() + "\n" + component.GetToolTip();
                    haveItem      = true;
                    break;

                case 1:
                    if (!canHaveHealth)
                    {
                        continue;
                    }
                    price         = fullHealPrice;
                    giveItem      = Heal;
                    itemText.text = "Full Healh";
                    haveItem      = true;
                    break;

                case 2:
                    if (!canHaveCharges)
                    {
                        continue;
                    }
                    price         = fullChargePrice;
                    giveItem      = RechargeSpells;
                    itemText.text = "Recharge Spells";
                    haveItem      = true;
                    break;

                default:
                    break;
                }
            }
            priceText.text = price.ToString();
        }
    }
예제 #2
0
 public void UpdateBaseStats(ISpellComponent component)
 {
     toolTip.text = "" + component.GetToolTip();
     cost.text    = "" + component.GetCost();
     title.text   = "" + component.GetTitle();
 }