void OnTriggerEnter(Collider other) { DamageCollider dc = other.GetComponentInChildren <DamageCollider>(); if (dc != null) { EnemyStates eStates = dc.GetComponentInParent <EnemyStates>(); if (eStates != null) { eStates.HandleBlocked(); } } }
void InitDamageColliders() { for (int i = 0; i < ai_attacks.Length; i++) { for (int j = 0; j < ai_attacks[i].damageCollider.Length; j++) { DamageCollider d = ai_attacks[i].damageCollider[j].GetComponent <DamageCollider>(); d.InitEnemy(states); } } for (int i = 0; i < states.defaultDamageCollider.Length; i++) { DamageCollider d = states.defaultDamageCollider[i].GetComponent <DamageCollider>(); d.InitEnemy(states); } }