示例#1
0
    public void BuyItem()
    {
        if (gi.gold >= cost)
        {
            PlayerController pcon  = GameObject.Find("Player").gameObject.GetComponent <PlayerController>();
            PlayerInfo       pinfo = pcon.pinfo;

            if (!isPotion && itemType > 0 && itemLevelTot > 0)
            {
                for (int i = 0; i < pinfo.items.Length; i++)
                {
                    if (pinfo.items[i].name == null)
                    {
                        gi.gold -= cost;

                        pinfo.items[i].SendOverStats(item);
                        pinfo.CalculateAll();
                        break;
                    }
                }
            }
            if (isPotion)
            {
                switch (potId)
                {
                case 1:
                    pinfo.AddHealingPots(1);
                    break;

                case 2:
                    pinfo.AddManaPots(1);
                    break;
                }
                abc.RefreshPotsAmountText();
                gi.gold -= cost;
            }
        }
    }
示例#2
0
    void UtilizeManaPotion()
    {
        bool mustWait = false;

        mustWait = potionCooldown[1].GetActivity();
        if (mustWait == false)
        {
            int healingPots = pinfo.GetManaPots();
            if (healingPots > 0)
            {
                float maxMP     = Mathf.RoundToInt(pinfo.stats.mp);
                int   healValue = Mathf.RoundToInt(maxMP * 0.25f);

                pinfo.stats.mpCur += healValue;
                pinfo.AddManaPots(-1);
                RefreshPotsAmountText();
                potionCooldown[1].SetActivity(true);

                potBlockImg[1].gameObject.SetActive(true);
                potCooldownText[1].gameObject.SetActive(true);
            }
        }
    }