Beispiel #1
0
    public Item GetAnItem(Item.EquipmentCategory equipType, Item.Type itemType)
    {
        //It is not a very optimized solution. we can easily cash "selectedItems" too. But currently, we suppose there are not many Item.
        System.Random random = new System.Random();

        List <Item> itemsOFType   = _equipmentItems[itemType];
        List <Item> selectedItems = new List <Item>();

        foreach (Item item in itemsOFType)
        {
            if (item.Equipment == equipType)
            {
                selectedItems.Add(item);
            }
        }
        Item selectedItem = selectedItems[random.Next(selectedItems.Count)];

        return(selectedItem);
    }
Beispiel #2
0
    public void SpawnItem(Item.Type itemType, Item.EquipmentCategory equipType)
    {
        Item item = ItemsDatabaseBahaviour.Instance.GetAnItem(equipType, itemType);

        CreatePickupableItem(item, UnityEngine.Random.Range(2, PICKUPABLE_ITEM_GENERATION_RADIUS));
    }
Beispiel #3
0
 private SlotState GetSlotState(Item.EquipmentCategory item)
 {
     return(Equipments[item].EquipmentState);
 }