public void addToInventory(Items.fruits fruit, int amount) { bool found = false; if (fruits.Count == 0) { fruits.Add(fruitcnt, fruit); fruitcnt++; } else { foreach (KeyValuePair <int, Items.fruits> entry in fruits) { if (entry.Value.getID() == fruit.getID() && !found) { fruits[entry.Value.getID()].addAmount(amount); } else { fruits.Add(fruitcnt, list.cloneFruit(fruit)); fruitcnt++; } } } }
public void setFruit(Items.fruits fruitToSet) { fruit = items.cloneFruit(fruitToSet); }