- Home /
Question by
importguru88 · Jul 23, 2016 at 06:09 AM ·
scripting problemerrormechanim animation
error CS1525: Unexpected symbol `nextState' / mecanim / anystate problem
I am trying to call my die animation by boolean . I getting some errors . The die animation is attach to the anystate . I tried set trigger as parameter the animation still wouldn't work . Here is what I got for a code so far . Here is a pic.
protected virtual void Awake()
{
dieState = Animator.StringToHash("Base Layer.Die");
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);
}
private void DieLocal(Vector3 position, Vector3 force)
{
// Notify those interested.
EventHandler.ExecuteEvent(m_GameObject, "OnDeath");
EventHandler.ExecuteEvent<Vector3, Vector3>(m_GameObject, "OnDeathDetails", force, position);
// Spawn any objects on death, such as an explosion if the object is an explosive barrell.
for (int i = 0; i < m_SpawnedObjectsOnDeath.Length; ++i) {
ObjectPool.Instantiate(m_SpawnedObjectsOnDeath[i], transform.position, transform.rotation);
}
// Destroy any objects on death. The objects will be placed back in the object pool if they were created within it otherwise the object will be destroyed.
for (int i = 0; i < m_DestroyedObjectsOnDeath.Length; ++i) {
if (ObjectPool.SpawnedWithPool(m_DestroyedObjectsOnDeath[i])) {
ObjectPool.Destroy(m_DestroyedObjectsOnDeath[i]);
} else {
Object.Destroy(m_DestroyedObjectsOnDeath[i]);
}
}
// Deactivate the object if requested.
if (m_DeactivateOnDeath || nextState != null nextState.name == "Base Layer.Die") {
Scheduler.Schedule(m_DeactivateOnDeathDelay, Deactivate);
GetComponent<AudioSource>().Play();
anim.SetBool("isDead",false);
}
}
a113.png
(234.6 kB)
Comment