public void RemoveObjectFromLists(GameObject objectToRemove) { if (objectToRemove.GetComponent <GameMachine>()) { AllGameMachines.Remove(objectToRemove.GetComponent <GameMachine>()); AllGameMachines.TrimExcess(); } else if (objectToRemove.GetComponent <FoodMachine>()) { AllFoodStalls.Remove(objectToRemove.GetComponent <FoodMachine>()); AllGameMachines.TrimExcess(); } else if (objectToRemove.GetComponent <ServiceMachine>()) { AllToilets.Remove(objectToRemove.GetComponent <ServiceMachine>()); AllGameMachines.TrimExcess(); } if (customerManager) { customerManager.SetGameMachines(AllGameMachines); customerManager.SetFoodStalls(AllFoodStalls); customerManager.SetToilets(AllToilets); } }
public void AddObjectToLists(GameObject objectToAdd) { if (objectToAdd.GetComponent <GameMachine>()) { AllGameMachines.Add(objectToAdd.GetComponent <GameMachine>()); } else if (objectToAdd.GetComponent <FoodMachine>()) { AllFoodStalls.Add(objectToAdd.GetComponent <FoodMachine>()); } else if (objectToAdd.GetComponent <ServiceMachine>()) { AllToilets.Add(objectToAdd.GetComponent <ServiceMachine>()); } if (customerManager) { customerManager.SetGameMachines(AllGameMachines); customerManager.SetFoodStalls(AllFoodStalls); customerManager.SetToilets(AllToilets); } }