public IEnumerator AgeDecay() { Dna.age = Dna.age + 1; yield return(new WaitForSeconds(1f)); switch (agemode) { case ageMode.young: Dna.age = Dna.age + 1; yield return(new WaitForSeconds(1f)); break; case ageMode.prime: yield return(new WaitForSeconds(40f)); agemode = ageMode.decay; break; case ageMode.decay: Dna.age = Dna.age - 1; yield return(new WaitForSeconds(1.8f)); break; } StartCoroutine(AgeDecay()); }
void Update() { if (Dna.age > 40) { agemode = ageMode.prime; } }