public void ReplaceFood(Food food) { if (food != null) { storedFoodList.Add(food); OnRemainedFoodCountChange?.Invoke(RemainedFoodCount); } }
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); }
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); } }