public bool AddItemToInventory(PickAndMountItem item)
    {
        if (inventoryLists.Count >= GameConstants.MaxInventoryList)
        {
            toastMessage.ShowMessage("Max items reached in inventory!!");
            return(false);
        }

        inventoryLists.Add(item);

        playerHUD.UpdatePlayerCollectedStats(inventoryLists.Count);

        return(true);
    }
示例#2
0
    public void OnMountButtonClicked()
    {
        if (inventoryUI.currentItemSlot?.itemPickUpType.mountableType == MountableTypesEnum.TYPE_E)
        {
            toastMessage.ShowMessage($"Item {inventoryUI.currentItemSlot.itemPickUpType.mountableType} not mountable!");
            dialogueManager.ShowMountDialoguePanel(false);
            return;
        }

        //Check if other item slot is being mounted, if true, unmount previous item slot first
        //and proceed for current item slot mounting
        if (playerMountHandler.CurrentMountedItemPickUp != null)
        {
            OnUnMountItem(inventoryUI.GetItemSlotForPickAndMountItem(playerMountHandler.CurrentMountedItemPickUp));
        }

        inventoryUI.currentItemSlot?.SetItemMounted(true);
        inventoryUI.currentItemSlot?.itemPickUpType.MountItem();
        dialogueManager.ShowMountDialoguePanel(false);

        //After Mounted reassign listener to OnUnMountButtonClicked
        ClearAndReassignListener(GetComponentInChildren <Button>(), OnUnMountButtonClicked);
    }