Beispiel #1
0
 void Reproduce()
 {
     if (isFemale)
     {
         r_Timer += Time.deltaTime;
         if (r_Timer >= r_Duration)
         {
             audioManager.Play("Reproduction");
             var newHuman = Instantiate(baby[Random.Range(0, baby.Length)], transform.position + Vector3.forward, Quaternion.identity);
             population.AddHuman(newHuman);
             //once reproduction is done set timer to 0 and reproduce again
             r_Timer = 0;
             currentBabies++;
             r_CoolDown = 0;
             GetComponent <HumanEat>().FoodNearBy();
             GetComponent <HumanEat>().eatTimer = 0;
             GetComponent <HumanEat>().canEat   = false;
             isReproducing = false;
             canReproduce  = false;
         }
     }
 }