Beispiel #1
0
    public void CycleWeapon(bool shouldGetPrev)
    {
        int    initiallySelected = CharacterInventory.Equipped.SelectedWeaponIndex;
        Weapon w = CharacterInventory.Equipped.CycleWeapon(shouldGetPrev);

        // If a new weapon has been selected
        if (CharacterInventory.Equipped.SelectedWeaponIndex != initiallySelected)
        {
            // equip the new weapon
            EquipItem(w);

            // Update the hud. Un-Select initiallySelected, Select SelectedWeaponIndex
            if (IsPlayer && GameManager.instance.GameHud != null)
            {
                GameManager.instance.GameHud.UpdateWeaponSlot(initiallySelected, false);
                GameManager.instance.GameHud.UpdateWeaponSlot(CharacterInventory.Equipped.SelectedWeaponIndex, true, w);

                InventoryScreen invScreen = (InventoryScreen)UIManager.instance.GetScreenInstance(ScreenName.Inventory);
                if (invScreen != null)
                {
                    invScreen.UpdateSlot(initiallySelected, true);
                    invScreen.UpdateSlot(CharacterInventory.Equipped.SelectedWeaponIndex, true);
                }
            }
        }
    }
Beispiel #2
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);
        }
    }