Beispiel #1
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Enemy"))
     {
         deathComponent.Death();
     }
 }
Beispiel #2
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Enemy"))
     {
         DeathComponent deathComponent = other.GetComponent <DeathComponent>();
         if (deathComponent)
         {
             deathComponent.Death();
         }
     }
 }