public void Eat() { if (IsDead) { return; } hp += eating.TryToEat(); }
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(); } }