public IEnumerator getWindImages() { float worldMapSize = 4096 * _currZoom;//_windImagesParent.GetComponent<RectTransform>().sizeDelta.x; int amount = Mathf.RoundToInt(Mathf.Sqrt((worldMapSize / 2048))); int maxxy = (int)Mathf.Pow(2, amount); Vector2 playerpos = MainGameController.instance.player.getCurrentLocationLatLon(); Vector3 pos = WorldMapController.LatitudeLongitudeToTileId(playerpos.x, playerpos.y, amount); int minx = (int)((pos.x - 2 >= 0) ? pos.x - 2 : 0); int maxx = (int)((pos.x + 2 < maxxy) ? pos.x + 2 : maxxy - 1); int miny = (int)((pos.y - 2 >= 0) ? pos.y - 2 : 0); int maxy = (int)((pos.y + 2 < maxxy) ? pos.y + 2 : maxxy - 1); int lastIndex = 0; _windImagesParent.SetActive(false); _loadingImage.SetActive(true); _zoominButton.interactable = false; _zoomOutButton.interactable = false; //_loadedIndex = MainGameController.instance.networkController.GetCurrentWeatherImageIndex(); int startIndex = _loadedIndex; int index = startIndex; for (int fx = minx; fx <= maxx; fx++) { for (int fy = maxy; fy >= miny; fy--) { OWMWeatherImage oWMWeatherImage = _downloadedWeatherImages.Where(x => x.ZoomLevel == _currZoom && x.Position == new Vector2(fx, fy) && (x.DownloadTime - System.DateTime.Now).Hours < 1).FirstOrDefault(); if (oWMWeatherImage == null) { index = MainGameController.instance.networkController.getWindImage(amount, fx, fy); } else { index++; oWMWeatherImage.Index = index; } lastIndex = index; StartCoroutine(WaitForImageResponse(index, new Vector2(fx, fy))); yield return(new WaitForSeconds(0.1f)); } } StartCoroutine(viewWeatherMapWhenDone(startIndex, lastIndex)); //float parentpos = ((worldMapSize / 2048) - 1) * 1024; //_windImagesParent.transform.localPosition = new Vector3(parentpos, -parentpos); //MainGameController.instance.networkController.getWindImage(0, 0, 0); //StartCoroutine(WaitForImageResponse()); }