Ejemplo n.º 1
0
 private void Update()
 {
     if (Input.GetKeyDown("space"))
     {
         // sleep
         if (animal.GetHungerLevel() > 50f && animal.GetThirstLevel() > 50f)
         {
             animal.UpdateHungerLevel(-40f);
             animal.UpdateThirstLevel(-40f);
             animal.gameObject.transform.localScale *= 1.5f;
         }
     }
 }
Ejemplo n.º 2
0
 public override void Consumed(BaseAnimal animal)
 {
     if (foodLeft > 0)
     {
         float update = Time.deltaTime * eaters[animal];
         foodLeft -= update;
         animal.UpdateHungerLevel(update);
         // Debug.Log(foodLeft);
     }
     else
     {
         // Debug.Log("food ran out");
         animal.SwitchToPreviousState();
         if (eaters.Count == 0)
         {
             Destroy(gameObject);
         }
     }
 }