예제 #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag(targetTag))
     {
         IHit hit = other.GetComponent <IHit>();
         if (hit != null)
         {
             hit.TakeDamage(weapon.damage);
             Destroy(gameObject);
         }
     }
 }
예제 #2
0
 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);
             }
         }
     }
 }