// Update is called once per frame void Update() { if (transform.rotation.x <= 90 && transform.rotation.x >= 89) { night = true; if (night && transform.rotation.x <= 89) { night = false; AIManager.IsNight(); AudioManager.bgmPlay(0); } } if (transform.rotation.x >= 0 && transform.rotation.x <= 1) { day = true; if (day && transform.rotation.x <= 89) { day = false; AudioManager.bgmPlay(1); } } //Checks if the day/night cycle is paused. if (!Pause) { //Rotates to the right. To do one full rotation it takes the timer time. transform.RotateAround(Vector3.zero, Vector3.right, (360f / timer) * Time.deltaTime); } }