コード例 #1
0
        //CONSUMABLE ITEMS
        public void AddConsumableItemToInventory(ConsumableItem item)
        {
            Boolean isInInventory = false;

            for (int i = 0; i < partyInventory.Count; ++i)
            {
                if (partyInventory[i].itemName == item.itemName)
                {
                    partyInventory[i].currentQuantity += 1;
                    isInInventory = true;
                    break;
                }
            }

            if (isInInventory == false)
            {
                item.currentQuantity = 1;
                partyInventory.Add(item);
            }
        }
コード例 #2
0
 public void DetermineValidItem(DataManager datamanager, Random rando)
 {
     if (hasItem == true)
     {
         if (eventItemType == Item.ItemType.Consumable)
         {
             earnedConsumableItem = datamanager.itemConsumableData[eventItemPosibilities[rando.Next(0, eventItemPosibilities.Count)]];
             earnedItemText       = earnedConsumableItem.itemName;
         }
         else if (eventItemType == Item.ItemType.Equipment)
         {
             earnedEquipmentItem = datamanager.itemEquipmentData[eventItemPosibilities[rando.Next(0, eventItemPosibilities.Count)]];
             earnedItemText      = earnedEquipmentItem.itemName;
         }
         else if (eventItemType == Item.ItemType.Loot)
         {
             earnedLootItem = datamanager.itemLootData[eventItemPosibilities[rando.Next(0, eventItemPosibilities.Count)]];
             earnedItemText = earnedLootItem.itemName;
         }
     }
 }