Example #1
0
    private void Click(int index)
    {
        //indexが範囲内でなかったらreturn
        if (!utility.Range.IsRangeOfInt(index, 0, itemList.Length - 1))
        {
            return;
        }

        ItemType type = itemList[index].type;

        if (type == ItemType.NONE)
        {
            return;
        }

        //アイテムを使用する
        Completed.GameManager.instance.UseItem(type);

        if (type == ItemType.FOOD1 || type == ItemType.FOOD2)
        {
            RemakePlayer remakeplayer = player.GetComponent <RemakePlayer>();
            remakeplayer.EatFood(data.ItemInfoData[type].value);

            //フードを食べた音を再生
            Completed.SoundManager.instance.RandomizeSfx(eat1, eat2);
        }
        if (type == ItemType.PORTION)
        {
            RemakePlayer remakeplayer = player.GetComponent <RemakePlayer>();
            remakeplayer.RecoveryHP(data.ItemInfoData[type].value);

            //飲み物再生
            Completed.SoundManager.instance.RandomizeSfx(drink1, drink2);
        }
    }
Example #2
0
    private void Start()
    {
        GameObject playerObj = GameObject.FindGameObjectWithTag("Player");

        playerStatus = playerObj.GetComponent <Status>();
        player       = playerObj.GetComponent <RemakePlayer>();

        hpdefault   = hpText.text;
        atkdefault  = atkText.text;
        defdefault  = defText.text;
        fooddefault = foodText.text;
    }