Code: Select all
rcol = 0
gcol = 0
bcol = 0
tme = 0
function lightcycle()
tme = GameMode.getTimeOfDay()
if tme >= 1.0 and tme <= 1.1 then
rcol = 2.6 - (tme - 1) * 16
gcol = 1.2 + (tme - 1) * 2
bcol = 1.1 + (tme - 1) * 6
elseif tme > 1.1 and tme < 1.9 then
rcol = 1
gcol = 1.4
bcol = 1.7
elseif tme >= 1.9 then
rcol = 1 + (tme - 1.9) * 13
gcol = 1.4 + (tme - 1.9) * 1
bcol = 1.7 - (tme - 1.9) * 2
elseif tme <= 0.1 then
rcol = 2.3 + tme * 7
gcol = 1.5 + tme * 15
bcol = 1.5 + tme * 9
elseif tme > 0.1 and tme < 0.9 then
rcol = 3.0
gcol = 3.0
bcol = 2.4
elseif tme >= 0.9 and tme < 1.0 then
rcol = 3.0 - (tme - 0.9) * 4
gcol = 3.0 - (tme - 0.9) * 18
bcol = 2.4 - (tme - 0.9) * 13
end
sky01.light:setColor(vec(rcol,gcol,bcol))
end