I was wondering how to chain actions and preserve order using scripting one after the other. For example:
Now I don't want the details of transformation/audio-playing/animation, as I already know how to do each of them. However, I don't know how to timely and orderly chain them one after the other so that once the first one finish, the second one start, and once it has finished the third one start etc.
asked Aug 21 '10 at 05:33 AM
You can use a call back method when another action is done to tell you when to fire the next step in the sequence. You can do this all in one script using boolean flags or you can separate out each task into its own game object and then you can place any combination of tasks into a game object array where they can be triggered in the correct order. You can even queue up the same object more than once if you want repeated actions.
You initialise the sequence by calling TaskDone(0);
If all the tasks were set as children of the game controller object you can simply use SendMessageUpwards to send the complete message to the controller.
If one of the tasks were to play an audio it'd look like this: