Ejemplo n.º 1
0
        protected virtual void Start()
        {
            Container.OnAddItem += (Item item, Slot slot) => {
                if (slot == this)
                {
                    ItemEventData eventData = new ItemEventData(item);
                    eventData.slot = slot;
                    Execute("OnAddItem", eventData);
                }
            };
            Container.OnRemoveItem += (Item item, int amount, Slot slot) => {
                if (slot == this)
                {
                    ItemEventData eventData = new ItemEventData(item);
                    eventData.slot = slot;
                    Execute("OnRemoveItem", eventData);
                }
            };
            Container.OnUseItem += (Item item, Slot slot) => {
                if (slot == this)
                {
                    ItemEventData eventData = new ItemEventData(item);
                    eventData.slot = slot;
                    Execute("OnUseItem", eventData);
                }
            };

            if (this.m_Stack != null)
            {
                this.m_Stack.raycastTarget = false;
            }
        }
Ejemplo n.º 2
0
        protected virtual void Start() {
            
            Container.OnAddItem += (Item item, Slot slot) => {
                if (slot == this)
                {
                    ItemEventData eventData = new ItemEventData(item);
                    eventData.slot = slot;
                    Execute("OnAddItem", eventData);
                }

            };
            Container.OnRemoveItem += (Item item, int amount, Slot slot) => {
                if (slot == this)
                {
                    ItemEventData eventData = new ItemEventData(item);
                    eventData.slot = slot;
                    Execute("OnRemoveItem", eventData);
                }

            };
            Container.OnUseItem += (Item item, Slot slot) => {
                if (slot == this)
                {
                    ItemEventData eventData = new ItemEventData(item);
                    eventData.slot = slot;
                    Execute("OnUseItem", eventData);
                }
            };  
        }