In the Animation class, is there a way to return which animation is currently being played?
Also, PlayQueued and CrossFadeQueued allow for queuing up multiple animations. Is there some way to read the queue? Find out which animations are in it or at least how many are currently queued?
If the animation doesn’t know what clip is playing, how does IsPlaying(clip) work? Wouldn’t it have to know what clip is playing in order to be able to compare it with another clip?
In light of the limitations of the animation class, I could use some advice on handling animations.
Say I have 6 animations. A, B, C, D, E, and F. Also a 7th animation as an idle when not doing one of the others.
Animation A plays once. It must finish before crossfading to the next animation.
Animation B plays once and is always followed by C.
Animation C loops and never returns to idle. When changing to a new animation it must first crossfade and play D, and then crossfade to the new animation.
Animation D is only played after completing C.
Animation E plays once and can immediately crossfade to another without finishing first.
Animation F plays once and must be completed before crossfading to the next animation. When F starts it also triggers a game event.
It would seem to me that using CrossFadeQueued is not an option because I have no way of telling which animation is playing, when it will end, and when the next one begins. Also, if I don’t know the frame on which F starts, I can’t trigger the event at the right frame.
For less abstract terms, let’s use a fighting game as an example of each animation type. The player loops idle until an event happens.
A = roundhouse kick. You don’t want to crossfade while a leg is up in the air, so it must finish first.
B = falling down. Plays once.
C = lying on the ground. Loops until the player issues a command.
D = getting up. Obviously you don’t want to fade from lying down directly into a punch.
E = block. Can be interrupted immediately for another move.
F = fireball. Spawns a paricle effect.
That might work for this simple example, but the actua game has over 35 animations. It would have a major impact on performance if I had to poll every frame to check one by one if that is the animation that is playing.
Setting up my own timing system through an array seems like the only real way to handle this. I can queue things to the end of the array, pop the first entry out, and control the timing of when elements change.