//Main function void Update() { //print(actionPickup.hasKey()); transform.localEulerAngles = new Vector3(transform.localEulerAngles.x, Mathf.LerpAngle(transform.localEulerAngles.y, (open ? doorOpenAngle : defaultRotationAngle), Time.deltaTime * smooth), transform.localEulerAngles.z); if (Input.GetKeyDown(KeyCode.F) && enter && actionPickup.hasKey()) { open = !open; } else { return; } }
private void Update() { if (actionPickup.hasKey()) { keyText = "Press 'F' to open the door"; } else { keyText = "You need a key to open this door"; } if (!stimer.timeEqualZero()) { if (shieldOn) { render.enabled = true; collider.enabled = true; stimer.playTimer(); } else { render.enabled = false; collider.enabled = false; stimer.stopTimer(); } } else { stimer.resetTimer(); shieldActivated = false; render.enabled = false; collider.enabled = false; } if (shieldActivated) { timer.enabled = true; icon.GetComponent <MeshRenderer>().enabled = false; icon.GetComponent <Collider>().enabled = false; if (Input.GetKeyDown(KeyCode.M)) { if (!shieldOn) { shieldOn = true; actionPickup.dropIt(); } else { shieldOn = false; } } } else { shieldOn = false; timer.enabled = false; icon.GetComponent <MeshRenderer>().enabled = true; icon.GetComponent <Collider>().enabled = true; } }