|
Hi all Unity users, I'm new to Unity and C# and been trying to get a hang on timing and sequencing using MonoBehavior.Update and Time.delta. I have the following code that chronologically triggers the change of animation at various specific times. The above code works as a series of animation cross-fade calls occuring once at a particular time each. I would call it "pulse events" because I am not sure about the correct technical terms. The above implementation looks really amateurish and inflexible as I would need as many bool as number of pulse events. Is there a better way to implement this? I tried looking for information on actual C# delegates and events on google but can't find one specific to what I have shown here.
(comments are locked)
|
|
Since you already know the amount of time you need between each animation, I would use a coroutine: http://unity3d.com/support/documentation/ScriptReference/index.Coroutines_26_Yield.html } Thanks for the quick reply! The link you have shown really explain the things I need in details. I totally overlook that when reading the manual. By the way, what does the return type IEnumerator means?
Jun 09 '11 at 09:25 AM
fisyher84
please use more specific titles for your questions in the future.
Jun 09 '11 at 11:49 AM
Anxowtf
I have updated the question title so it should be clearer now.
Jun 10 '11 at 01:50 AM
fisyher84
(comments are locked)
|

Since the question is already answered I'd just like to point out that m_TimeIntervalAccum = 0.0f; should be m_TimeIntervalAccum--; for your function to be run on average once a second. Your way it would always be called after little over a second, which can of course accumulate. ;)