IEnumerator Spread() { yield return(new WaitUntil(() => size > 0.8f)); while (true) { float timeToSpread = HushPuppy.RandomFloat(timeBetweenSpreads); yield return(new WaitForSeconds(timeToSpread)); int offspring = Random.Range(1, this.maxSpreadOffspring + 1); for (int i = 0; i < offspring; i++) { Generate(); } } }
public void ResetState() { this.timeOfDeath = HushPuppy.RandomFloat(this.lifeExpectancyRange); this.lifetime = 0f; this.isDead = false; }