Day Time Controller
Last updated
Last updated
Presented by IDayTimeController
interface, this system allows to simulate switching between day and night.
To use it, just add DayTimeController prefab onto your game scene and set it up as you wish.
Sun – reference to Light source which will be moved
Day Length – length of day in seconds
Night Length - length of night in seconds
Time Of Day – initial time of day (from 0 to 1, where 0 is sunrise, 0.5 is sunset and 1 is sunrise again).
You can also set current time of day via code. For this, you need to inject this system to needed class and call SetTimeOfDay
method, like shown below:
You should pass number from 0 to 1 as parameter, where 0 is sunrise, 0.5 is sunset and 1 is sunrise again. It's easier to understand with this simple diagram:
You can see how it works on the WeatherTestScene
, which is situated in Assets/Heroic Engine/Example/Scenes
directory.