- Home /
Question by
Saravia95 · May 02, 2014 at 05:54 PM ·
animationanimatoranimator controlleranimationclip
End of animation with animator.
I am having a small problem here with my code, I want to trigger my ragdoll for my raptor once the death animation has ended but,I can't seem to figure out of to know when the animation has ended, it is within the animator so I know .IsPlaying will not work.
Here is the code for my raptor once it has 0 health:
if (_currentHealth <= 0)
{
RaptorAnimator.SetBool ("died", true);
//I NEED SOMETHING IN THIS "IF" TO KNOW WHEN
//THE DIED ANIMATION FINISHED!
if (!RaptorAnimator.IsPlaying ("DieFWRagdoll")) {
// Destroy (GetComponent<Animator> ());
Ragdoll r = GetComponent<Ragdoll> ();
if (r != null) {
r.OnDeath ();
}
Destroy (GetComponent<EnemyMovement> ());
Destroy (GetComponentInChildren<RaptorAttack> ());
Destroy (GetComponent<CharacterController> ());
} else {
}
}
I would really like an explanation on how I could do this. Any help would be really appreciated!
Comment