Ejemplo n.º 1
0
 public void Eat()
 {
     if (IsDead)
     {
         return;
     }
     hp += eating.TryToEat();
 }
Ejemplo n.º 2
0
        private void TryToEat()
        {
            var foodEaten = eating.TryToEat();

            if (foodEaten <= 0)
            {
                AddReward(-0.001f);
                return;
            }

            totalFoodEaten += foodEaten;
            AddReward(foodEaten * 0.1f);
            if (totalFoodEaten > 10)
            {
                SetReward(2f);
                Done();
            }
        }