I have stuck in a logical problem I have a third party package of DayNight. It takes hours input(24-hour-format) to show dayNight effects in scene
My code is to transform 12 hours clock cycle into 24 hours is
if (todsky.Cycle.Hour >= 0 && todsky.Cycle.Hour < 11.97)
{
Debug.LogError("1st");
var degree = 360 - hourniddle.transform.eulerAngles.z;
var degreeToMintues = degree * 2; //multiply each degree with 2 to get correct minutes
ConvertMinutesToHours(degreeToMintues); //
}
else if (todsky.Cycle.Hour > 11.97 && todsky.Cycle.Hour < 23.97)
{
Debug.LogError("2ndt");
var degree = 360 - hourniddle.transform.eulerAngles.z; // as rotation is anti-clock getting rever degree
var degreeToMintues = degree * 2; //multiply each degree with 2 to get correct minutes
var MintuestTo24HoursMintueCoverstion = 720 + degreeToMintues; //add 720 mintues into current minute in order to get 24-hour-format
ConvertMinutesToHours(MintuestTo24HoursMintueCoverstion);
}
void ConvertMinutesToHours(float mintues) {
result = TimeSpan.FromMinutes(mintues);
Debug.LogWarning(result.Hours + ":" + result.TotalHours + ":" + result.Minutes + ":" + result.TotalMinutes);
todsky.Cycle.Hour = (float) result.TotalHours;
Debug.LogWarning("setted hours : " + todsky.Cycle.Hour);
}
But it is not working correctly . have made a clock GUI(360-degree) and as you know it only show 12 digits-format not 24. I am getting clock needle movement which can be change through mouse drag. Needle z position up to 320 degree which means one degree is equal to 2 minutes and i am taking it as input from GUI. I write below code to integrate my clock needle with my DayNight package in order to integrate GUI with package and passing hour parameter into the package but it not working correctly. Problem is that else condition is skipping.
realLifeTime * 10
or something, so can't you just update that in your loop and feed that into the day/night cycle code? \$\endgroup\$