Ejemplo n.º 1
0
        private static GameObject CreateMap()
        {
            GameObject map = new GameObject
            {
                name = "City Boundary"
            };
            AbstractMap          mapShape     = map.AddComponent <AbstractMap>();
            AbstractTileProvider tileProvider = map.AddComponent <ManhattanTiles>();

            mapShape.Options.extentOptions.extentType = MapExtentType.Custom;
            mapShape.TileProvider      = tileProvider;
            mapShape.InitializeOnStart = false;
            mapShape.Options.scalingOptions.scalingType     = MapScalingType.WorldScale;
            mapShape.Options.placementOptions.placementType = MapPlacementType.AtTileCenter;
            mapShape.Options.placementOptions.snapMapToZero = true;
            ElevationLayerProperties elevation = new ElevationLayerProperties();

            elevation.modificationOptions.sampleCount = 2;
            mapShape.Terrain.Update(elevation);
            mapShape.Terrain.SetElevationType(ElevationLayerType.FlatTerrain);

            CreateCity(mapShape);
            Object.DestroyImmediate(mapShape);
            Object.DestroyImmediate(tileProvider);

            return(map);
        }
Ejemplo n.º 2
0
        public override void Initialize(ElevationLayerProperties elOptions)
        {
            _elevationOptions     = elOptions;
            _meshData             = new Dictionary <UnwrappedTileId, Mesh>();
            _currentTileMeshData  = new MeshData();
            _stitchTargetMeshData = new MeshData();
            var sampleCountSquare = _elevationOptions.modificationOptions.sampleCount * _elevationOptions.modificationOptions.sampleCount;

            _newVertexList   = new List <Vector3>(sampleCountSquare);
            _newNormalList   = new List <Vector3>(sampleCountSquare);
            _newUvList       = new List <Vector2>(sampleCountSquare);
            _newTriangleList = new List <int>();
        }
        public override void Initialize(ElevationLayerProperties elOptions)
        {
            base.Initialize(elOptions);

            _meshSamples          = new Dictionary <int, MeshDataArray>();
            _dataArrays           = new Dictionary <UnwrappedTileId, MeshDataArray>();
            _cachedMeshDataArrays = new Dictionary <UnityTile, MeshDataArray>();

            _meshData            = new Dictionary <UnwrappedTileId, Mesh>();
            _currentTileMeshData = new MeshData();
            var sampleCountSquare = _elevationOptions.modificationOptions.sampleCount * _elevationOptions.modificationOptions.sampleCount;

            _newVertexList   = new List <Vector3>(sampleCountSquare);
            _newNormalList   = new List <Vector3>(sampleCountSquare);
            _newUvList       = new List <Vector2>(sampleCountSquare);
            _newTriangleList = new List <int>();
        }
Ejemplo n.º 4
0
        public static void SetElevation(Elevation type, AbstractMap map)
        {
            ElevationLayerProperties elevation = new ElevationLayerProperties();

            map.Terrain.EnableCollider(true);
            if (type == Elevation.Real)
            {
                elevation.modificationOptions.earthRadius = Constants.R * 1000;
                elevation.modificationOptions.sampleCount = 10;
                map.Terrain.Update(elevation);
                map.Terrain.SetElevationType(ElevationLayerType.TerrainWithElevation);
                return;
            }
            elevation.modificationOptions.sampleCount = 2;
            map.Terrain.Update(elevation);
            map.Terrain.SetElevationType(ElevationLayerType.FlatTerrain);
        }
Ejemplo n.º 5
0
 public override void SetOptions(LayerProperties options)
 {
     _elevationOptions = (ElevationLayerProperties)options;
 }
Ejemplo n.º 6
0
 public override void SetOptions(LayerProperties options)
 {
     _elevationOptions = (ElevationLayerProperties)options;
     Strategy.Initialize(_elevationOptions);
 }
Ejemplo n.º 7
0
 public override void Initialize(ElevationLayerProperties elOptions)
 {
     _elevationOptions = elOptions;
 }
Ejemplo n.º 8
0
 public virtual void Initialize(ElevationLayerProperties elOptions)
 {
     _elevationOptions = elOptions;
 }