private void OnTriggerEnter(Collider other) { if (other.CompareTag(targetTag)) { IHit hit = other.GetComponent <IHit>(); if (hit != null) { hit.TakeDamage(weapon.damage); Destroy(gameObject); } } }
public void OnTriggerEnter(Collider other) { if (other.CompareTag(targetTag)) { IHit ihit = other.GetComponent <IHit>(); if (ihit != null) { if (ihit.TakeDamage(damage)) { parentUnit.killCount++; } pierce--; if (pierce < 0) { Destroy(gameObject); } } } }