public static void Update() { List <Lot> lotChoices = new List <Lot>(); foreach (Lot lot in LotManager.AllLots) { if (!IsValidLot(lot, null)) { continue; } lotChoices.Add(lot); } List <FoodTruck> truckList = new List <FoodTruck>(Sims3.Gameplay.Queries.GetObjects <FoodTruck>()); int trucksToSpawn = 0x0; int count = truckList.Count; if (count < Traffic.Settings.mMaxFoodTrucks) { if (lotChoices.Count > FoodTruckManager.kMinWideParkingSpaceRequired) { trucksToSpawn = 0x1; } else if (lotChoices.Count < FoodTruckManager.kMinWideParkingSpaceRequired) { trucksToSpawn = lotChoices.Count - FoodTruckManager.kMinWideParkingSpaceRequired; } } else if (count > Traffic.Settings.mMaxFoodTrucks) { trucksToSpawn = Traffic.Settings.mMaxFoodTrucks - count; } else if ((Traffic.Settings.mRequireFoodParkingSpace) && (lotChoices.Count < FoodTruckManager.kMinWideParkingSpaceRequired)) { trucksToSpawn = lotChoices.Count - FoodTruckManager.kMinWideParkingSpaceRequired; } if ((trucksToSpawn > 0x0) && (lotChoices.Count > 0x0)) { Lot randomObjectFromList = RandomUtil.GetRandomObjectFromList(lotChoices); lotChoices.Remove(randomObjectFromList); FoodTruck truck = FoodTruckManager.AddTruckIntoWorld(randomObjectFromList); if (truck != null) { truckList.Add(truck); } } if (Common.kDebugging) { Common.DebugNotify("Food Truck Manager: " + truckList.Count + " " + trucksToSpawn + " " + lotChoices.Count); } if (truckList.Count > 0x0) { RandomUtil.RandomizeListOfObjects <FoodTruck>(truckList); foreach (FoodTruck truck in truckList) { if ((trucksToSpawn < 0x0) || (lotChoices.Count == 0) || ((SimClock.IsNightTime()) && (!Traffic.Settings.mAllowFoodTruckAtNight))) { truck.FadeOut(false, true); trucksToSpawn++; } else if (lotChoices.Count > 0x0) { bool moveToNewLot = FoodTruckEx.MoveToNewLot(truck); if ((moveToNewLot) || (!IsValidLot(TruckController.GetLot(truck), truck))) { Lot item = RandomUtil.GetRandomObjectFromList(lotChoices); lotChoices.Remove(item); FoodTruckEx.RouteToNewLot(truck, item); Common.DebugNotify("Food Truck: ", truck.ObjectId, item.ObjectId); TruckController.AddTruck(truck); } } FoodTruckEx.AddMapTags(truck); } } }
public DefaultScope() { InstanceUnderTest = new FoodTruckManager(FoodTruckProviderMock.Object); }