public void AddTrait(Trait trait) { if (!HasTrait(trait)) { TraitLeveler tl = new TraitLeveler(); tl.trait = trait; traits.Add(tl); } }
public static Genome Breeding(Genome g1, Genome g2) { Genome child = new Genome(); if(g1.traits.Count == g2.traits.Count) { for(int i=0;i<g1.traits.Count;++i) { TraitLeveler tl = new TraitLeveler(); if (UnityEngine.Random.Range(0, 1.0f) <= 0.5f) tl.trait = g1.traits[i].trait; else tl.trait = g2.traits[i].trait; tl.currentLevel = 0; tl.currentExp = 0; child.traits.Add(tl); } } return child; }