Extending Hardly Brief Dan's Day and Night Cycle
Hello all,
I've recently been following this great series of tutorials from Hardly Brief Dan (Programming).
In his day and night cycle I'm wondering how to extend it further as I'm new to the use of delegates and their use in this situation, and he never returns to this topic to explain it's implementation further. (Although I'm sure he's shown plenty to extend it to do anything I just can't quite understand how to yet.)
Here's his current setup...
TimeManager.cs -> tracks game time and can be referenced to check the time.
EventManager.cs -> delegates and their static methods (I'm hazy when looking at this class).
Sun.cs -> A use of the EventManager and TimeManager class to rotate a directional light around the x axis based on the time of day.
In his setup, how would you go about adding specific timed events such as 'Hey, it's morning now, play a rooster caw sound' or 'Hey, it's night now play a wolf howl'. Or other similar timed based events like lighting torches at night and extinguishing them at dawn.
Would it be better to write some type of base class like BaseTimedEntity (something similar I wrote for BurgZergs day/night cycle), and just give it a time and a bool and then inherit and override that class to check that bool and do whatever with? How could this be done properly with delegates?
What is the best route to take with his setup? Thanks in advance and sorry for such a long-winded post (and code-dump).
$$anonymous$$oved to HelpRoom, but this sort of long back-and-forth collaboration is more for the forums. Is fine in the HelpRoom, but the people who are interested in working on project might be more likely to see it there.
(The FAQ on the right column here explains regular UA vs. forum, a little.)
Your answer
![](https://koobas.hobune.stream/wayback/20220612090306im_/https://answers.unity.com/themes/thub/images/avi.jpg)