// Update is called once per frame void Update() { float overlayAlpha = Mathf.InverseLerp(.95f, 1f, IdyllTime.dayNightBlend); bool showingOverlayThisFrame = overlayAlpha > 0; //One time event per day/night cycle if (showingOverlayThisFrame && !showedOverlayLastFrame) { stableDaysPassed = IdyllTime.GetGameDay(); } //map(IdyllTime.dayNightBlend, .95, 1, 0,1); canvasGroup.alpha = overlayAlpha; displayIdyllDay.text = "End of day " + stableDaysPassed; //+ "\n Tomorrow is day " + (stableDaysPassed+1); showedOverlayLastFrame = showingOverlayThisFrame; }
// Update is called once per frame void Update() { //0 degrees = beginning of sunrise //90 = sun at highest point in sky (noon) //180 = sun (sunset) //270 = moon has risen if (IdyllTime.GetGameClockTimeHrs() >= 0 && IdyllTime.GetGameClockTimeHrs() < IdyllTime.sunsetStartTime) { this.transform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(90, 270, IdyllTime.dayNightBlend)); } else { this.transform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(90, 270, IdyllTime.dayNightBlend)); } }