// Update is called once per frame void Update() { float raw24HourTime = IdyllTime.GetGameClockTimeHrs(); //0 to 24 //want something like 1:15 AM, 3:30 PM, 11:59 AM //(raw24HourTime) -> (desired display) //13.5 -> 1:30 PM //1.75 -> 1:45 AM //0.25 -> 12:45 AM //12.33333 -> 12:20 PM float hourFraction = raw24HourTime % 1; //give 13.5 -> 0.5 (part of the number after decimal point) // (hourDigits) : (minuteDigits) float hourDigits = Mathf.Floor(raw24HourTime) % 12; if (hourDigits == 0) { hourDigits = 12; } float minutes = Mathf.Floor(hourFraction * 60); IdyllClockText.text = hourDigits + " : " + minutes + "\nDay: " + IdyllTime.GetGameDay(); //Debug.Log(IdyllTime.GetGameTimeHrs(); }
// 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; }