Esempio n. 1
0
    void UpdateInventoryItemUI(InventoryPickupDestination pickupType, int slot)
    {
        InventoryScreen invScreen = (InventoryScreen)UIManager.instance.GetScreenInstance(ScreenName.Inventory);

        if (pickupType == InventoryPickupDestination.backpack)
        {
            if (invScreen != null)
            {
                invScreen.UpdateSlot(slot, false);
            }
        }
        else if (pickupType == InventoryPickupDestination.equipped)
        {
            if (invScreen != null)
            {
                invScreen.UpdateSlot(slot, true);
            }
            GameManager.instance.UpdateHudSlot(slot);
        }
    }
Esempio n. 2
0
    public InventoryPickupState AddItem(Item item, bool attemptEquip)
    {
        InventoryPickupDestination destination = InventoryPickupDestination.none;

        int slot = -1;

        if (attemptEquip)
        {
            slot = Equipped.EquipItem(item);
        }
        if (slot >= 0)
        {
            // !!! TODO will need to generalize for different item types
            destination = slot == Equipped.SelectedWeaponIndex ? InventoryPickupDestination.selected : InventoryPickupDestination.equipped;

            if (ParentCharacter.IsPlayer)
            {
                UpdateInventoryItemUI(InventoryPickupDestination.equipped, slot);
            }
        }
        else
        {
            slot = AddToBackpack(item);

            if (slot >= 0)
            {
                destination = InventoryPickupDestination.backpack;

                if (ParentCharacter.IsPlayer)
                {
                    UpdateInventoryItemUI(InventoryPickupDestination.backpack, slot);
                }
            }
        }

        return(new InventoryPickupState(slot, destination));
    }
Esempio n. 3
0
 public InventoryPickupState(int _slot, InventoryPickupDestination _dest)
 {
     Slot        = _slot;
     Destination = _dest;
 }