// Update is called once per frame void Update() { if (dayEndTimer.Update(Time.deltaTime)) { if (endOfDayText[0].enabled) { EndOfDay(true); wepSpawner.RefillWeps(); } dayTimer.Update(Time.deltaTime); //This roates the light source to make it look like a day night cycle // theSun.transform.Rotate(Vector3.right * Time.deltaTime * speedOfSun); var rot = theSun.transform.eulerAngles; rot = Vector3.zero; // rot.x = dayTimer.GetPercent() * 360.0f; theSun.transform.eulerAngles = rot; theSun.transform.Rotate(Vector3.right, dayTimer.GetPercent() * 360.0f); // Update the UI bar with the rotation of the sun SetUIBar(); //Check if the sun is at a specific angle or passed it. If so set end of day to true and reset the suns position // if (theSun.transform.eulerAngles.x > 195) if (dayTimer.IsDone()) { endOfDay = true; DAY++; // theSun.transform.Rotate(Vector3.right * Time.deltaTime * speedOfSun * 5); dayTimer.Reset(); EndOfDay(); dayEndTimer.Reset(); moneyMan.checkIfMoneyGoalIsMet(DAY); } // else if (endOfDay && theSun.transform.eulerAngles.x < 16) // { // endOfDay = false; // EndOfDay(true); // } } }