Exemple #1
0
    public void EnterItemChoices(Script_ItemChoices _itemChoices)
    {
        inventoryViewController.gameObject.SetActive(false);

        itemChoices = _itemChoices;
        itemChoices.gameObject.SetActive(true);

        EventSystem.current.gameObject.SetActive(false);
    }
Exemple #2
0
    // ------------------------------------------------------------------
    // Item Choices
    public bool ShowItemChoices(int itemSlotId, Types type)
    {
        switch (type)
        {
        case Types.Stickers:
            if (GetItemInStickers(itemSlotId))
            {
                return(true);
            }
            break;

        case Types.Items:
            if (GetItemInItems(itemSlotId))
            {
                return(true);
            }
            break;
        }

        Debug.Log("no item in slot");
        ErrorDullSFX();
        return(false);

        bool GetItemInStickers(int itemSlotId)
        {
            if (inventory.GetItemInSlot(itemSlotId))
            {
                // SBook Controller will handle EventSystem, setting active
                Script_Item item = inventory.GetItemInSlot(itemSlotId);
                switch (item)
                {
                case Script_Sticker sticker:
                    itemChoices = stickerChoices;
                    break;

                default:
                    Debug.Log("Error. Did not match a type for this item.");
                    break;
                }

                itemChoices.itemSlotId = itemSlotId;
                itemChoices.SetDropChoice(item.isDroppable);
                sBookController.EnterItemChoices(itemChoices);
                stickersChoicesInputManager.gameObject.SetActive(true);

                return(true);
            }

            return(false);
        }

        bool GetItemInItems(int itemSlotId)
        {
            if (items.GetItemInSlot(itemSlotId))
            {
                // SBook Controller will handle EventSystem, setting active
                Script_Item item = items.GetItemInSlot(itemSlotId);

                Debug.Log($"ITEM IS TYPE: {item.GetType()}");

                switch (item)
                {
                case Script_Collectible collectible:
                    itemChoices = collectibleChoices;
                    break;

                case Script_Usable collectible:
                    itemChoices = usableChoices;
                    break;

                default:
                    Debug.Log("Error. Did not match a type for this item.");
                    break;
                }

                itemChoices.itemSlotId = itemSlotId;
                itemChoices.SetDropChoice(item.isDroppable);
                itemsController.EnterItemChoices(itemChoices);
                itemsChoicesInputManager.gameObject.SetActive(true);

                return(true);
            }

            return(false);
        }
    }