I have a simple question (I am bad at math...). So i made a day/night cycle in my game and to change the time of the day i have slider ranging from 0 to 1. Everything is working correctly, but i can't convert this time in minutes.
Here is a bit of the code I am using:
Where time is my slider (float) and timeRate (float) a time multiplier.
private void Update(){
time += timeRate * Time.deltaTime;
ConvertTime();
}
private void ConvertTime()
{
hours = 24 * time;
minutes = ?;
if(minutes >= 60)
minutes = 0;
displayRealTime = LeadingZero(hours.ToString("0")) + ":" + "00";
}
The "LeadingZero" function just add a 0 if the number < 10.
The hours are good but i don't know how to get the minutes. Thanks for reading.