I really can’t wrap my head around this. I’ve had no problems doing this kind of thing in other programs bu I can’t figure this out in Unity/C#. Here’s what I want to do.
I have a static function in a static class that gets triggered. This function handles a whole sequence of events and presentation effects that use different objects that are all timed to go off in the future in a timed sequence. As a simple English example:
A) Slide down a splash page
wait a second
B) Trigger an animation of some sparkles, play a sound effect
wait a second
C) Slide on some buttons
wait a second
D) Pop on a message that says “select your choice”
etc. etc.
Usually, my chain of events is much more complicated than this, but this is a general idea. The way I would handle this kind of thing is to create a series of timers, that when they timedown to 0, it triggers the appropriate action of each step of the presentation. Again, not really code based, but enough to get my thinking…
time = 0
CreateTimer(time, SplashPage, move)
time = time + 1000
CreateTimer(time, sparkles, animate)
CreateTimer(time, sparkles, sound)
time = time + 1000
CreateTimer(time, button1, move)
CreateTimer(time, button2, move)
CreateTimer(time, button3, move)
time = time + 1000
CreateTimer(time, Message_Choice, move)
Anyway, I can’t find a good example of doing something like this. I’ve fund examples for things like “in game” timers, but nothing that would relate to pacing of long chains of presentation. I’ve tried toying around with StartCoroutine, but that doesn’t work with static function from what I can tell, and when I call the startCoroutine to an outside object, that doesn’t seem to pause the the static function, it just, well starts a coroutine on that object that pauses itself. Well, aside from some other issues (like passing a lot of variables around).
Should I be looking harder at trying to understand the events/delegates? Or is there something I’m missing with regards to creating little virtual timebombs that go off and trigger functions and then destroy themselves?