void OnTriggerStay(Collider collider) { if (collider.tag == "Player" && !electroPanel.IsSwitched() && !electroPanel.IsPlayingAudio() && !door.IsActive()) { isColliding = true; playerMessage.text = "F - Pull Electrical Switch"; } else if (electroPanel.IsPlayingAudio() || door.IsActive()) { isColliding = false; playerMessage.text = ""; } }
void OnTriggerStay(Collider collider) { if (collider.tag == "Player" && (!door.HasTriedToOpen() || electroPanel.IsPowerDown()) && !door.IsDoorOpen() && !electroPanel.IsPlayingAudio() && !door.IsActive()) { isColliding = true; playerMessage.text = "F - Open Door"; } else if ((door.HasTriedToOpen() && !electroPanel.IsPowerDown()) || door.IsDoorOpen() || electroPanel.IsPlayingAudio() || door.IsActive()) { playerMessage.text = ""; } }
void Update() { if (Input.GetKeyDown(KeyCode.F) && !audioPlayer.isPlaying && switchCollider.IsCollidingWithPlayer() && !door.IsActive()) { if (!isSwitched) { audioPlayer.clip = switchSound; audioPlayer.Play(); isSwitched = true; Invoke("PowerDown", switchSound.length); } } }