public void AddCargo(InventoryItem item) { FrameworkCore.PlayCue(sounds.Fanfare.item); ItemPopup popup = new ItemPopup(menuManager); popup.inventoryItem = item; menuManager.AddMenu(popup); FrameworkCore.players[0].AddCargo(item); }
/// <summary> /// give inventory item to player /// </summary> public void AddCargo() { if (inventoryPool.Count <= 0) { //inventory pool is empty. refill it back up! PopulateInventory(); } FrameworkCore.PlayCue(sounds.Fanfare.item); int itemIndex = FrameworkCore.r.Next(inventoryPool.Count); FrameworkCore.players[0].AddCargo(inventoryPool[itemIndex]); ItemPopup popup = new ItemPopup(menuManager); popup.inventoryItem = inventoryPool[itemIndex]; menuManager.AddMenu(popup); //now remove the item from the pool. inventoryPool.RemoveAt(itemIndex); }