Пример #1
0
    public bool UseItem()
    {
        ItemDes._Instance.Hide(itemId);
        ObjectInfo info = ObjectsInfo._Instance.GetObjectInfo(itemId);

        if (info.type == ObjectType.Equip)
        {
            bool dressSuccess = Equipment._Instance.Dress(itemId);
            if (dressSuccess)
            {
                InventoryItemGrid itemGrid = gameObject.transform.parent.GetComponent <InventoryItemGrid>();
                itemGrid.SubNum();
            }
        }
        else if (info.type == ObjectType.Drug)
        {
            InventoryItemGrid itemGrid = gameObject.transform.parent.GetComponent <InventoryItemGrid>();
            if (itemGrid.SubNum())
            {
                playerStatus.PlusHpAndMp(info.hp, info.mp);
                return(true);
            }
        }
        return(false);
    }