예제 #1
0
 private void OnTriggerEnter(Collider other)
 {
     Debug.Log("Some Collision");
     if (other.gameObject.tag == "Player")
     {
         OnInvisibility?.Invoke();
         Destroy(this.gameObject);
     }
 }
예제 #2
0
 private void WatchPlayer()
 {
     if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.back), out RaycastHit hit, 5))
     {
         if (hit.transform.gameObject.tag == "Player")
         {
             if (isEnabled)
             {
                 OnInvisibility?.Invoke();
             }
             Destroy(this.gameObject);
         }
         else
         {
             DrawColoredRay(Color.blue);
         }
     }
 }