/// <summary> /// The Create. /// </summary> /// <param name="collection">The collection<see cref="FeatureCollection"/>.</param> /// <param name="scale">The scale<see cref="float"/>.</param> /// <param name="city">The city<see cref="GameObject"/>.</param> public override void Create(dynamic collection, float scale, GameObject city) { var parent = CityGeneratorHelper.GetParentTransformFromCity(city, CityElements.Water); var buildingFeature = CityGeneratorHelper.GetFeatureBasedOnPropertyValueName(collection, _idName); if (buildingFeature == null) { return; } var polygon = CityGeneratorHelper.GetPolygonsFromFeature(buildingFeature); Mesh mesh = CityGeneratorHelper.CreateMeshFromGeoJsonPolygon(polygon, _waterPrefab, parent, scale); string folderName = AssetFolderHelper.CreateFolderToSaveCity(city, MeshFolder.Folder); AssetDatabase.CreateAsset(mesh, folderName + "water.asset"); }
/// <summary> /// The Create. /// </summary> /// <param name="collection">The collection<see cref="FeatureCollection"/>.</param> /// <param name="scale">The scale<see cref="int"/>.</param> /// <param name="city">The city<see cref="GameObject"/>.</param> public override void Create(dynamic collection, float scale, GameObject city) { var _parent = CityGeneratorHelper.GetParentTransformFromCity(city, CityElements.Buildings); var buildingFeature = CityGeneratorHelper.GetFeatureBasedOnPropertyValueName(collection, idName); if (buildingFeature == null) { return; } var polygons = CityGeneratorHelper.GetPolygonsForBuildings(buildingFeature); int meshIndex = 0; string folderName = AssetFolderHelper.CreateFolderToSaveCity(city, MeshFolder.Folder); foreach (var poly in polygons) { Mesh mesh = CityGeneratorHelper.CreateMeshFromGeoJsonPolygon(poly, _buildingPrefab, _parent, scale); AssetDatabase.CreateAsset(mesh, folderName + meshIndex + ".asset"); meshIndex++; } }