I have two different enemy ai I only gotten one trigger parameter to play on one of my enemy ai . I name the trigger parameter the same as the other enemy ai . I change one of the enemy ai and the die animation still didn’t work when I kill the enemy ai . The die animation is not set on loop . I also tried closing the animator tab and restarting . I deleted the parameter and re-adding the parameter press and die animation still don’t work. Here is my script :
// Exposed properties
public bool Invincible { set { m_Invincible = value; } }
public float MaxHealth { set { m_MaxHealth = value; } }
public float MaxShield { set { m_MaxShield = value; } }
public float CurrentHealth { get { return m_CurrentHealth; } }
public float CurrentShield { get { return m_CurrentShield; } }
public float ShieldRegenerativeAmount { set { m_ShieldRegenerativeAmount = value; } }
public AudioClip deathClip;
public bool isSinking;
static Animator anim;
void Start ()
{
anim = GetComponent<Animator> ();
}
// Internal variables
#if ENABLE_MULTIPLAYER
[SyncVar(hook = "SetHealthAmount")]
#endif
private float m_CurrentHealth;
#if ENABLE_MULTIPLAYER
[SyncVar(hook = "SetShieldAmount")]
#endif
private float m_CurrentShield;
private ScheduledEvent m_ShieldRegenerativeEvent;
private float m_SpawnTime;
// SharedFields
protected float SharedProperty_MaxHealth { get { return m_MaxHealth; } }
protected float SharedProperty_MaxShield { get { return m_MaxShield; } }
protected float SharedProperty_CurrentHealth { get { return m_CurrentHealth; } }
protected float SharedProperty_CurrentShield { get { return m_CurrentShield; } }
// Component references
protected GameObject m_GameObject;
protected Transform m_Transform;
private Rigidbody m_Rigidbody;
/// <summary>
/// Cache the component references and initialize the default values.
/// </summary>
protected virtual void Awake()
{
anim = GetComponent <Animator>();
m_GameObject = gameObject;
m_Transform = transform;
m_Rigidbody = GetComponent<Rigidbody>();
SharedManager.Register(this);
m_CurrentHealth = m_MaxHealth;
m_CurrentShield = m_MaxShield;
// Register for OnRespawn so the health and sheild can be reset.
EventHandler.RegisterEvent(m_GameObject, "OnRespawn", OnRespawn);
}
if (m_DeactivateOnDeath) {
Scheduler.Schedule(m_DeactivateOnDeathDelay, Deactivate);
GetComponent<AudioSource>().Play();
anim.SetTrigger("Dead");
anim.SetTrigger("death");
}
}