private void Init()
        {
            globe        = GetComponent <Globe>();
            textureCache = globe != null
                ? globe.tileTextureCache ?? GetComponent <TileTextureCache>()
                : GetComponent <TileTextureCache>();

            initialized = true;
        }
Beispiel #2
0
        private IEnumerator Start()
        {
            //instantiate stored components
            downloader  = GetComponent <DownloadManager>();
            tileFactory = GetComponent <TileFactory>();
            if (tileTextureCache == null)
            {
                tileTextureCache =
                    GetComponent <TileTextureCache>(); //GameObject.Find("TileTextureCache").GetComponent<TileTextureCache>();
            }

            //start processes
            //Load the local text files used to initialize the LayerLoader
            //this is done before the information is needed because you cannot access TextAsset from a thread
            LayerLoader.Init();

            //Kick off the main xml parsing in a thread to keep the application from hanging, especially for vr
            new Thread(() =>
            {
                //get the available layers by parsing the xml
                availableLayers = LayerLoader.GetLayers();
                //let the main thread know that it is safe to try to access the layers
                parsedAvailableLayers = true;
            }).Start();
            WaitForEndOfFrame w = new WaitForEndOfFrame();

            //wait for the xml to finish parsing
            while (!parsedAvailableLayers)
            {
                yield return(w);
            }

            LoadLayer(initialLayer, initialDateTime);
            CreateRootTiles();
            StartCoroutine(UpdateTileVisibility());
        }