So I have this day night cycle script that works on your computers time, and I was wondering if there’s a way for it to know what day it is too? like Monday and stuff
the code:
#pragma strict
var color1 : Color = Color.red;
var color2 : Color = Color.blue;
var Day : Light;
var Night : Light;
var dt = Date();
var timetext : GUIText;
function Update () {
var day = dt.Now.Day.ToString();
var month = dt.Now.Month.ToString();
var year = dt.Now.Year.ToString();
var hours = dt.Now.Hour.ToString();
var minutes = dt.Now.Minute.ToString();
if (parseInt(minutes) < 10) minutes = "0" + minutes;
var seconds = dt.Now.Second.ToString();
if(parseInt(seconds) < 10) seconds = "0" + seconds;
timetext.text = day + "/" + month + "/" + year + " " + hours + ":" + minutes + ":" + seconds;
if(parseInt(hours) > 19)
{
Day.enabled = false;
Night.enabled = true;
camera.backgroundColor = color2;
}
if(parseInt(hours) < 7)
{
Day.enabled = false;
Night.enabled = true;
}
if(parseInt(hours) < 19)
{
Day.enabled = true;
Night.enabled = false;
camera.backgroundColor = color1;
}
if(parseInt(hours) > 7)
{
Day.enabled = true;
Night.enabled = false;
}
}