/// <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");
        }
Ejemplo n.º 2
0
        /// <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.Rivers);
            var riversFeature = CityGeneratorHelper.GetFeatureBasedOnPropertyValueName(collection, idName);

            if (riversFeature == null)
            {
                return;
            }
            var polygons = CityGeneratorHelper.GetPolygonsFromFeature(riversFeature);

            foreach (var poly in polygons)
            {
                Vector3[] positions;
                var       lineRenderer = MultiLineStringHandler.CreateLineRenderer(_riverPrefab, _parent);
                MultiLineStringHandler.UpdateLineRendererPoints(poly, out positions, scale, lineRenderer);
            }
        }
Ejemplo n.º 3
0
        /// <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.Walls);
            var wallFeature = CityGeneratorHelper.GetFeatureBasedOnPropertyValueName(collection, _idName);

            if (wallFeature == null)
            {
                return;
            }
            var lineStrings = CityGeneratorHelper.GetPolygonsFromFeature(wallFeature);

            if (_createWallsSeparately)
            {
                CreateWallsSeparately(scale, parent, lineStrings);
            }
            else
            {
                CreateContiniousWall(scale, parent, lineStrings);
            }
        }
        /// <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++;
            }
        }