void OnTriggerEnter(Collider other) { UnitRange range = other.GetComponent <UnitRange>(); if (range != null) { if (m_CoreType == 1) // maincore는 모든유닛들이 공격 { UnitBase unit = range.transform.root.GetComponentInChildren <UnitBase>(); unit.AddDestroyTarget(m_CoreID); } else // subcore는 지상유닛만 공격함 { UnitWalking unit = range.transform.root.GetComponentInChildren <UnitWalking>(); if (unit != null) { unit.AddDestroyTarget(m_CoreID); } } } }