private void OnTriggerEnter(Collider other) { Debug.Log("Some Collision"); if (other.gameObject.tag == "Player") { OnInvisibility?.Invoke(); Destroy(this.gameObject); } }
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); } } }