Beispiel #1
0
    // 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();
    }
Beispiel #2
0
 // 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));
     }
     
 }