Exemplo n.º 1
0
    public Weapon UnequipWeapon()
    {
        Weapon oldWeapon = null;

        if (currentWeapon != null)
        {
            oldWeapon = currentWeapon;
            Inventory.Instance.AddItem(oldWeapon);
            weaponSlot.ClearSlot();

            currentWeapon = null;
            if (weaponInstance != null)
            {
                Destroy(weaponInstance.gameObject);
            }

            if (onWeaponChanged != null)
            {
                onWeaponChanged.Invoke(null, oldWeapon);
            }
        }


        return(oldWeapon);
    }
 private void ClearInventoryGrid()
 {
     if (!equipmentGrid)
     {
         equipmentGrid = FindObjectOfType <ItemGrid>();
     }
     HangarInventorySlot[] slots = equipmentGrid.GetComponentsInChildren <HangarInventorySlot>();
     foreach (HangarInventorySlot slot in slots)
     {
         slot.ClearSlot();
     }
 }
Exemplo n.º 3
0
    void UpdateUI()
    {
        if (Equipment.instanse.item != null)
        {
            slot.AddItem(Equipment.instanse.item);
        }
        else
        {
            slot.ClearSlot();
        }

        Inventory.instanse.onItemChangedCallback.Invoke();
    }