Ejemplo n.º 1
0
 //Add/Replace item to player inventory. This method is subscribed to OnItemPickupEvent
 public void AddItemToPlayerInv(ItemObject _item)
 {
     am.PlaySound(_item.pickupSound);
     if (inventory.itemList.Count < inventory.defaultCapacity) //If player inventory is not full
     {
         //insert picked item to player inventory on the first index
         inventory.InsertItemToInv(_item, 0);
     }
     else //If player inventory is full
     {
         //"Drop" replaced item to the ground by instantiating its prefab
         DropItem(this);
         //Replace currently equipped item with picked item.
         inventory.InsertItemToInv(_item, 0);
     }
 }