I have created a list for item database but even if i added a new item, list doesnt show the rest of the item except 2 elemets.
public List<Item> itemDatabase = new List<Item>();
public Sprite[] spriteBox = new Sprite[] { };
private void Awake()
{
AddItem(new Item("carrot", "gathered from garden", 5, 10, Item.ItemType.food, spriteBox[0]), 5, 15); //this is appear
AddItem(new Item("potion", "made by alchemist", 10, 10, Item.ItemType.consumable, spriteBox[7]), 3); //this is appear
AddItem(new Item("posionousPotion", "made by alchemist", 10, 10, Item.ItemType.consumable, spriteBox[7]), 0, 0, 0, 0, 3); //This item doesnt appear in the inspector.
}
private void AddItem(Item item,params int[] stats)
{
itemDatabase.Add(item);
switch(item.itemType)
{
//we've set these properties here and after using item these are gonna add its properties to player stat.
case Item.ItemType.food:
item.health = stats[0];
item.hunger = stats[1];
break;
case Item.ItemType.consumable:
item.fastSpeed = stats[0];
item.concentrate = stats[1];
item.instantHealthLoss = stats[2];
item.starving = stats[3];
item.slowWalking = stats[4];
break;
}
}