Exemplo n.º 1
0
        public IEnumerator ReloadMap(Coordinates location, bool delayed)
        {
            if (!dynamicLoad)
            {
                yield break;
            }

            GOFeature.BuildingElevationOffset *= locationManager.worldScale;
            GOFeature.RoadsHeightForElevation *= locationManager.worldScale;

            //Get SmartTiles
            List <Vector2> tileList = location.adiacentNTiles(zoomLevel, tileBuffer);

            List <GOTile> newTiles = new List <GOTile> ();

            // Create new tiles
            foreach (Vector2 tileCoords in tileList)
            {
                if (!isSmartTileAlreadyCreated(tileCoords, zoomLevel))
                {
                    GOTile adiacentSmartTile = createSmartTileObject(tileCoords, zoomLevel);
                    adiacentSmartTile.gameObject.transform.position = adiacentSmartTile.goTile.tileCenter.convertCoordinateToVector();
                    adiacentSmartTile.map = this;

                    newTiles.Add(adiacentSmartTile);

                    if (tileBackground != null)
                    {
                        adiacentSmartTile.createTileBackground();
                    }
                }
            }

            foreach (GOTile tile in newTiles)
            {
                if (Application.isPlaying)
                {
                    yield return(tile.StartCoroutine(tile.LoadTileData(layers, delayed)));
                }
                else
                {
                    GORoutine routine = GORoutine.start(tile.LoadTileData(layers, delayed), tile);
                    while (!routine.finished)
                    {
                        yield return(null);
                    }
                }
            }

            //Destroy far tiles
            List <Vector2> tileListForDestroy = location.adiacentNTiles(zoomLevel, tileBuffer + 1);

            if (destroyTilesRoutine != null)
            {
                yield return(destroyTilesRoutine);
            }
            destroyTilesRoutine = DestroyTiles(tileListForDestroy);
            yield return(StartCoroutine(destroyTilesRoutine));
        }
Exemplo n.º 2
0
        public IEnumerator createTileWithPreloadedData(Vector2 tileCoords, int Zoom, bool delayedLoad, object mapData)
        {
                        #if GOLINK
            switch (goTerrain.goTerrainOptions.vectorAPI)
            {
            case  GOTerrainOptions.VectorAPI.MapzenJSON:
                mapType = GOMapType.MapzenJson;
                break;

            case  GOTerrainOptions.VectorAPI.Mapzen:
                mapType = GOMapType.Mapzen;
                break;

            case  GOTerrainOptions.VectorAPI.Mapbox:
                mapType = GOMapType.Mapbox;
                break;
            }
                        #endif

            if (!isSmartTileAlreadyCreated(tileCoords, zoomLevel))
            {
                GOTile tile = createSmartTileObject(tileCoords, zoomLevel);
//				tile.gameObject.transform.position = tile.goTile.tileCenter.convertCoordinateToVector();
//				tile.map = this;

                if (tileBackground != null)
                {
                    tile.createTileBackground();
                }

                yield return(tile.StartCoroutine(tile.ParseTileData(layers, delayedLoad, layerNames())));

                if (OnTileLoad != null)
                {
                    OnTileLoad.Invoke(tile);
                }
            }
            yield return(null);
        }