Beispiel #1
0
    private void BuyItem()
    {
        switch (_itemPanels[_currItemPanelIdx].Type)
        {
        case Item.ItemType.Hp:
            if (_status.CoinCount.Value >= ItemInfo.HpItemPrice)
            {
                SoundManager.instance.PlaySelectSound1();

                _status.AddHpItem();
                _status.CoinCount.Value -= ItemInfo.HpItemPrice;
            }
            else
            {
                SoundManager.instance.PlayWrongSelectSound();
            }
            break;

        case Item.ItemType.Mp:
            if (_status.CoinCount.Value >= ItemInfo.MpItemPrice)
            {
                SoundManager.instance.PlaySelectSound1();

                _status.AddMpItem();
                _status.CoinCount.Value -= ItemInfo.MpItemPrice;
            }
            else
            {
                SoundManager.instance.PlayWrongSelectSound();
            }
            break;
        }
    }
Beispiel #2
0
    private void ItemGathered()
    {
        SoundManager.instance.PlayItemGetSound();

        CharacterStatus charStatus = _player.GetComponent <CharacterStatus>();

        if (_itemType == ItemType.Hp)
        {
            charStatus.AddHpItem();
        }
        else if (_itemType == ItemType.Mp)
        {
            charStatus.AddMpItem();
        }
        else if (_itemType == ItemType.Coin)
        {
            charStatus.AddCoin();
        }

        Destroy(gameObject);
    }