public void addToInventory(Items.seeds seed, int amount) { Items.seeds s = null; bool found = false; if (seeds.Count == 0) { seeds.Add(seedcnt, list.cloneSeed(seed)); seeds[seedcnt].addAmount(amount); seedcnt++; } else { foreach (KeyValuePair <int, Items.seeds> entry in seeds) { if (entry.Value.getID() == seed.getID() && found == false) { s = entry.Value; found = true; } } if (found) { s.addAmount(amount); } else { seeds.Add(seedcnt, list.cloneSeed(seed)); seeds[seedcnt].addAmount(amount); seedcnt++; } } }
public int get_seedID() { if (planted) { return(seed.getID()); } else { return(0); } }
public Items.seeds cloneSeed(Items.seeds s) { Items.seeds ret = new Items.seeds(s.getID(), s.getName(), s.getCorPlant()); return(ret); }