Beispiel #1
0
        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++;
                }
            }
        }
Beispiel #2
0
    public void setSeed(Items.seeds seedToSet)
    {
        seed = items.cloneSeed(seedToSet);
        var rend = gameObject.GetComponent <Renderer>();

        rend.material = seedTex;
    }