public void OnRefill() { inventory.Clear(); int resCount = 0; foreach (UCE_HarvestingHarvestItems harvestItem in harvestItems) { if (UnityEngine.Random.value <= harvestItem.probability) { int amount = (UnityEngine.Random.Range(harvestItem.minAmount, harvestItem.maxAmount)); for (int i = 1; i <= amount; i++) { inventory.Add(new ItemSlot(new Item(harvestItem.template))); } resCount += amount; if (resCount >= currentResources) { break; } } } currentResources -= resCount; }
private void OnRefill() { inventory.Clear(); gold = Random.Range(lootGoldMin, lootGoldMax); coins = Random.Range(lootCoinsMin, lootCoinsMax); foreach (ItemDropChance itemChance in dropChances) { if (Random.value <= itemChance.probability) { inventory.Add(new ItemSlot(new Item(itemChance.item))); } } }
// ----------------------------------------------------------------------------------- // resetGuildWarehouse // ----------------------------------------------------------------------------------- public void resetGuildWarehouse() { UCE_guildWarehouse.Clear(); _guildWarehouseGold = 0; _guildWarehouseLevel = 0; }