/// <summary> /// OnTriggerEnter is called when the Collider other enters the trigger. /// </summary> /// <param name="other">The other Collider involved in this collision.</param> void OnTriggerEnter(Collider other) { if (other.tag == "Player") { if (other.GetComponent <FirstPersonController>().hasKey) { lockedPannel.SetActive(false); unlockedPannel.SetActive(true); door.OpenDoor(); } else { deniedSound.Play(); } } }