// Update is called once per frame void Update() { rayHit = Physics2D.Raycast(transform.position, transform.up, DIST_RAY); if (rayHit.collider != null && rayHit.collider.tag == "City") { // Debug.Log ("City in range: " + rayHit.transform.name); if (!overCity) { IdentifyCity(); GameManager.instance.bg.SetActive(true); string code = GameManager.instance.CheckCityWeather(rayHit.collider.name.ToString()); } //Enables color area for text box background } else { if (!overCity) { GameManager.instance.cityName.text = null; GameManager.instance.bg.SetActive(false); } } if (overCity == true) { timeOverCity = Mathf.Clamp01(timeOverCity + Time.deltaTime); //After 1sec this variable will be one if (timeOverCity == 1f) { UtilScript.SaveTransformPosition(this.transform, Application.dataPath, fileName); SceneManager.LoadScene(1); timeOverCity = 0; } } else { timeOverCity = Mathf.Clamp01(timeOverCity - Time.deltaTime); } progressImage.fillAmount = timeOverCity; // Update UI image }