void OnTriggerEnter(Collider other) { if (states) { EnemyStates es = other.transform.GetComponentInParent <EnemyStates>(); if (es != null) { // do damage es.DoDamage(); } return; } if (eStates) { StateManager st = other.transform.GetComponentInParent <StateManager>(); if (st != null) { st.DoDamage(eStates.GetCurrentAttack()); } return; } }