예제 #1
0
 public void ReplaceFood(Food food)
 {
     if (food != null)
     {
         storedFoodList.Add(food);
         OnRemainedFoodCountChange?.Invoke(RemainedFoodCount);
     }
 }
예제 #2
0
 public void FillFood(Food food, int count)
 {
     for (int foodCount = 0; foodCount < count; foodCount++)
     {
         Food newFood = food.Duplicate();
         foodList.Add(newFood);
         storedFoodList.Add(newFood);
     }
     OnRemainedFoodCountChange?.Invoke(RemainedFoodCount);
 }
예제 #3
0
 public bool TakeFood(Ant ant)
 {
     if (!ant.IsTakingFood && storedFoodList.Count > 0)
     {
         Food food = storedFoodList[0];
         if (ant.TakeFood(food))
         {
             storedFoodList.RemoveAt(0);
             OnRemainedFoodCountChange?.Invoke(RemainedFoodCount);
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }