public override void probeObject(GameObject obj) { LivingAgent ag = obj.GetComponent<AnimalAgent> (); if (ag != null) { this.ag = ag; this.sg = obj.GetComponent<SimpleGenome>(); } }
public static SimpleGenome Breeding(SimpleGenome g1, SimpleGenome g2) { SimpleGenome sg = Instantiate<SimpleGenome> (g1); int x = Random.Range (0, 100); sg.alimentation = (x <= 50) ? g1.alimentation : g2.alimentation; x = Random.Range (0, 100); sg.blood = (x <= 50) ? g1.blood : g2.blood; x = Random.Range (0, 100); sg.skin = (x <= 50) ? g1.skin : g2.skin; if(g1.others.Count > 0 && g2.others.Count == 0) { for(int i=0;i<g1.others.Count;++i) { x = Random.Range(0,100); if(x<=50) sg.others.Add(g1.others[i]); } } return sg; }
public void Reset(SimpleGenome genome) { alimentation = EvolutionNames.Alimentation.Omnivore; cached_bool_values.Clear (); cached_float_values.Clear (); SetBaseValues(); UpdateDNAByTrait(genome.alimentation); UpdateDNAByTrait(genome.blood); UpdateDNAByTrait(genome.skin); foreach(Trait trait in genome.others) UpdateDNAByTrait(trait); }
public new void Start() { base.Start (); destroyable = true; dna = GetComponent<AgentDNA> (); genome = GetComponent<SimpleGenome>(); timerHolder.AddTimer ("wiggle", wigglingTime); dna.Reset (genome); SetCurrentValue (EvolutionNames.AgentSelf.Energy, dna.GetEnergyMaximum ()); SetCurrentValue (EvolutionNames.AgentSelf.Health, dna.GetHealthMaximum ()); SetCurrentValue(EvolutionNames.AgentSelf.Temparature, dna.GetInnerTemparature()); SetCurrentValue (EvolutionNames.AgentSelf.DNAPoints, 0.0f); SetCurrentValue (EvolutionNames.AgentSelf.Score, 0.0f); }