Beispiel #1
0
        public AudioClip onAddItemAudioClip; // When an item is added to the inventory


        public override void Awake()
        {
            base.Awake();

            if (isLootToInventory)
            {
                InventoryManager.AddInventoryCollection(this, lootPriority);
            }

            if (sortButton != null)
            {
                sortButton.onClick.AddListener(() =>
                {
                    SortCollection();

                    if (sortAudioClip)
                    {
                        InventoryUIUtility.AudioPlayOneShot(sortAudioClip);
                    }
                });
            }

            // Listen for events
            OnAddedItem += (InventoryItemBase items, uint slot, uint amount) =>
            {
                if (onAddItemAudioClip != null)
                {
                    InventoryUIUtility.AudioPlayOneShot(onAddItemAudioClip);
                }
            };
            OnSwappedItems += (ItemCollectionBase fromCollection, uint fromSlot, ItemCollectionBase toCollection, uint toSlot) =>
            {
                if (swapItemAudioClip != null)
                {
                    InventoryUIUtility.AudioPlayOneShot(swapItemAudioClip);
                }
            };
            OnDroppedItem += (InventoryItemBase item, uint slot, GameObject droppedObj) =>
            {
            };
            OnResized += (uint fromSize, uint toSize) =>
            {
                StartCoroutine(SetScrollToZero());
            };
            OnSorted += () =>
            {
            };
            OnGoldChanged += (float goldAdded) =>
            {
            };
        }