private void Update() { if (doorBehaviour.GetFinished() && !isFinished) { isHot = doorBehaviour.GetHot(doorNumber - 1); isNoisy = doorBehaviour.GetNoisy(doorNumber - 1); isSafe = doorBehaviour.GetSafe(doorNumber - 1); isFinished = true; //string log = "Door " + doorNumber + " is done"; //Debug.Log(log); } // I probably should've put all this stuff into their own functions, but at this point I'm just going to leave it // this activates the correct UI elements for hot/noise when the player is touching the door if (colliding) { if (isHot) { fireYes.SetActive(true); } else { fireNo.SetActive(true); } if (isNoisy) { noisyYes.SetActive(true); } else { noisyNo.SetActive(true); } uiOneActive = true; } // this deactivates any activated UI elements when the player stops touching the door else { if (uiOneActive) { if (isHot) { fireYes.SetActive(false); } else { fireNo.SetActive(false); } if (isNoisy) { noisyYes.SetActive(false); } else { noisyNo.SetActive(false); } uiOneActive = false; } if (uiTwoActive) { if (isSafe) { safeYes.SetActive(false); } else { safeNo.SetActive(false); } uiTwoActive = false; } } // this triggers the corresponding safe UI element if the player // presses the interact key while touching the door if (Input.GetButtonDown("Interact") && colliding) { if (isSafe) { SafeDoor(); } else { UnsafeDoor(); } } }