public override Gene Combine(Gene vOther) { Debug.Assert(vOther.GetType() == GetType(), "Illegal EyeGene Combine"); if (Chance(MutationRate)) { return(new Rotation()); //Random Mutation } return(Chance(50.0f) ? Clone() : vOther.Clone()); }
public override Gene Combine(Gene vOther) { Debug.Assert(vOther.GetType() == typeof(EyeColour), "Illegal EyeGene Combine"); if (Chance(MutationRate)) { return(new EyeColour()); //Random Mutation } return(new EyeColour(Color.Lerp(mColour, ((EyeColour)vOther).mColour, Random.Range(0.0f, 1.0f)))); }
static public Gene FindMatchingGene(Gene vMyGene, DNA vOtherDNA) { Gene tMatch = vOtherDNA.mGenes.Find(o => o.GetType() == vMyGene.GetType()); return(tMatch); }