示例#1
0
 public void OnTriggerEnter2D(collider2D other)
 {
     if (other.GameObject.CompareTag("enemy"))
     {
         Destroy(this.GameObject);
     }
 }
示例#2
0
 private void OnTriggerExit2D(collider2D collision)
 {
     if (collision.gameObject.CompareTag("Player"))
     {
         IsInRange = false;
         collision.GetComponent <PlayerManager>().DeNotifyPlayer();
         Debug.Log("Player now not in range");
     }
 }