Exemplo n.º 1
0
    public void AddItem(IInventoryItem item)
    {
        if (hasItem(item.Name))
        {
            return;
        }

        if (mItems.Count < SLOTS)
        {
            Player player = GameObject.Find("Player").GetComponent <Player>();
            player.ApplyPowerUp(item.Name);
            mItems.Add(item);
            if (hasBrokenItem(item))
            {
                brokenItems.Remove(item);
            }
            if (!item.Equals(null))
            {
                item.OnPickup();
            }

            if (ItemAdded != null)
            {
                ItemAdded(this, new InventoryEventArgs(item));
            }
        }
    }