Esempio 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);
        }
Esempio n. 2
0
 public static void SetUpAbstractMap(AbstractMap map, AbstractTileProvider tiles)
 {
     map.Options.extentOptions.extentType = MapExtentType.Custom;
     map.TileProvider      = tiles;
     map.InitializeOnStart = false;
     map.Options.scalingOptions.scalingType     = MapScalingType.WorldScale;
     map.Options.placementOptions.placementType = MapPlacementType.AtTileCenter;
     map.Options.placementOptions.snapMapToZero = true;
     map.Options.tileMaterial = Resources.Load("Materials/TileMaterial") as Material;
     map.ImageLayer.SetLayerSource(ImagerySourceType.Custom);
     map.ImageLayer.UseCompression(true);
     map.ImageLayer.UseMipMap(true);
     map.ImageLayer.SetLayerSource(Constants.mapStyle);
     map.VectorData.SetLayerSource(VectorSourceType.MapboxStreetsWithBuildingIds);
 }