IEnumerator Copulate(Creature mate) { if (this.gender == Gender.MALE) { var mateProcess = IntentProcess.Proc_Copulate(15f, this.gameObject); mate.GetComponent <CPU>().Interrupt(mateProcess); } else { StartCoroutine(Gestate(this, mate)); } yield return(new WaitForSeconds(1f)); this.reproductiveUrge_x = this.gender == Gender.FEMALE ? Mathf.PI : 0f; this.reproductiveUrge = 0f; }
void HandleCreature(GameObject obj) { if (obj == null) { return; } float distance = Vector3.Distance(this.transform.position, obj.transform.position); var targetCreature = obj.GetComponentInChildren <Creature>(); if (this.gender == Gender.MALE && targetCreature.gender == Gender.FEMALE) { if (this.reproductiveUrge * targetCreature.reproductiveUrge > 0.7f) { var mateProcess = distance < TOUCHING_DISTANCE? IntentProcess.Proc_Copulate(5f, obj) : IntentProcess.Proc_GoMate(this.reproductiveUrge * targetCreature.reproductiveUrge * 2f, obj); cpu.Interrupt(mateProcess); } } }