IEnumerator constructAll(List <Service> services, List <IslandGO> islandGOs) { Dictionary <ServiceSlice, List <Service> > serviceSliceMap = distributeServicesToSlices(services); foreach (KeyValuePair <ServiceSlice, List <Service> > kvp in serviceSliceMap) { constructServicesAndComponents(kvp.Value, kvp.Key); yield return(null); } foreach (IslandGO islandGO in islandGOs) { if (islandGO == null) { continue; } else { if (!islandGO.isIslandEmpty()) { foreach (Region region in islandGO.getRegions()) { foreach (Building b in region.getBuildings()) { ServiceLayerGO serviceLayer = b.GetComponent <ServiceLayerGO>(); if (serviceLayer != null) { serviceLayer.createDownwardConnections(); List <ServiceNodeScript> snsList = serviceLayer.getServiceNodes(); foreach (ServiceNodeScript sns in snsList) { sns.constructServiceConnections(); } } } } } } } Debug.Log("Finished with Service-GameObject construction!"); status = Status.Finished; cb(); }
IEnumerator constructAll(List <Service> services, List <Island> Islands) { Dictionary <ServiceSlice, List <Service> > serviceSliceMap = distributeServicesToSlices(services); foreach (KeyValuePair <ServiceSlice, List <Service> > kvp in serviceSliceMap) { constructServicesAndComponents(kvp.Value, kvp.Key); yield return(null); } foreach (Island Island in Islands) { if (Island == null) { continue; } else { if (!Island.IsIslandEmpty()) { foreach (Region region in Island.Regions) { foreach (Building b in region.Buildings) { ServiceLayerGO serviceLayer = b.GetComponent <ServiceLayerGO>(); if (serviceLayer != null) { serviceLayer.createDownwardConnections(); List <ServiceNodeScript> snsList = serviceLayer.getServiceNodes(); foreach (ServiceNodeScript sns in snsList) { sns.constructServiceConnections(); } } } } } } } ServiceGameObjectsBuilt(new ServiceGameObjectsBuiltEventArgs(Islands)); }