Example #1
0
        /// <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);

            foreach (var poly in polygons)
            {
                Vector3[] positions;
                var       lineRenderer = MultiLineStringHandler.CreateLineRenderer(_buildingLinePrefab, _parent);
                MultiLineStringHandler.UpdateLineRendererPoints(poly, out positions, scale, lineRenderer);
            }
        }
        /// <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++;
            }
        }