我遵循了这个tip,但是我根据我的C#脚本进行了调整。我的死亡动画不会在死亡中播放。那是为什么?
这是我的代码
public class EnemyHealthManager : MonoBehaviour {
...
private Animator fireAnimator;
public AnimationClip fireDeathAnimation;
// Use this for initialization
void Start() {
currentHealth = maxHealth;
fireAnimator = GetComponent<Animator> ();
}
// Update is called once per frame
void Update() {
if (currentHealth <= 0)
{
fireAnimator.Play(fireDeathAnimation.name); //play Fire_Death animation on death
Destroy(gameObject, 1.0f); //dies after 1.0f seconds so that death animation can play
}
}
}