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; } } }
public override void Consumed(BaseAnimal animal) { if (this.foodLeft > 0) { float update = Time.deltaTime * eaters[animal]; this.foodLeft -= update; animal.UpdateThirstLevel(update); Debug.Log(this.foodLeft); } else { Debug.Log("food ran out"); animal.SwitchToPreviousState(); if (eaters.Count == 0) { Destroy(this.gameObject); } } }