/// <summary> /// Initializes room with chest /// </summary> public override void Populate() { base.Populate(); var chest = GetComponentInChildren <Chest>(); var possibleItems = PrefabHelper.GetItems <Relic>(); chest.hiddenItem = possibleItems.ElementAt(Random.Range(0, possibleItems.Count())); }
/// <summary> /// Adds random potion to the inventory. There is 50% chance to add potion to inventory /// </summary> void AddRandomConsumableItemsToInventory() { // 50% chance to add potion if (Random.value < 0.5f) { var consumables = PrefabHelper.GetItems <Consumable>(); var createdConsumable = Instantiate(consumables.ElementAt(Random.Range(0, consumables.Count()))); Character.Inventory.AddItem(createdConsumable.GetComponent <Item>()); createdConsumable.transform.localPosition = new Vector3(0, 1, 0); } }