Пример #1
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.CompareTag("Goal"))
     {
         Logics.AddScore();
         Destroy(this.gameObject);
     }
 }
Пример #2
0
 void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Player"))
     {
         Debug.Log("Player scored!");
         Logics.AddScore();
         Destroy(this.gameObject);
     }
     else if (collision.gameObject.CompareTag("Ground"))
     {
         Destroy(this.gameObject);
     }
 }