Exemplo n.º 1
0
 private void Update()
 {
     if (WeatherApi != null && ApiKey != null && WeatherZoneScript != null)
     {
         WeatherZoneScript.gameObject.SetActive(true);
         ElapsedTime += Time.unscaledDeltaTime;
         if (ElapsedTime >= UpdateRateSeconds)
         {
             ElapsedTime = 0.0f;
             float lat, lon;
             if (Latitude < -998.0f || Longitude < -998.0f)
             {
                 lat = (float)WeatherMakerDayNightCycleManagerScript.Instance.Latitude;
                 lon = (float)WeatherMakerDayNightCycleManagerScript.Instance.Longitude;
             }
             else if ((Latitude > 998.0f || Longitude > 998.0f) && Input.location.isEnabledByUser && Input.location.status == LocationServiceStatus.Running)
             {
                 lat = Input.location.lastData.latitude;
                 lon = Input.location.lastData.longitude;
             }
             else
             {
                 if (Latitude >= -90.0f && Latitude <= 90.0f && Longitude >= -180.0f && Longitude <= 180.0f)
                 {
                     lat = Latitude;
                     lon = Longitude;
                 }
                 else
                 {
                     lat = (float)WeatherMakerDayNightCycleManagerScript.Instance.Latitude;
                     lon = (float)WeatherMakerDayNightCycleManagerScript.Instance.Longitude;
                 }
             }
             WeatherApi.QueryWeather(lat, lon, PlaceName, ApiKey, weatherCallback);
         }
     }
 }