/// <summary> /// Called every frame /// </summary> protected void Update() { //If player left clicks while in the rock trigger if (Input.GetMouseButtonDown(0) && inRock) { if (!Cursor.visible) { aud.Play(); } //lock camera to proper location and angle character.LockCam(camLocation, angleY, angleX); //make cursor visible Cursor.lockState = CursorLockMode.None; Cursor.visible = true; //fire tabletActivate event tabletActivate.Invoke(tabletNum); } //If player right clicks while in the rock trigger else if ((Input.GetMouseButtonDown(1) || Input.GetKeyDown("escape")) && inRock) { if (Cursor.visible) { aud.Play(); } //unlock camera character.UnlockCam(); //make cursor invisible Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; //fire tabletActivate event with deactivate case (-1) tabletActivate.Invoke(-1); } if (sliderState == SliderState.Appearing) { if (cg.alpha < 1) { cg.alpha += Time.deltaTime * SLIDER_RATE; } else { sliderState = SliderState.None; } } else if (sliderState == SliderState.Disappearing) { if (cg.alpha > 0) { cg.alpha -= Time.deltaTime * SLIDER_RATE; } else { sliderState = SliderState.None; slider.SetActive(false); } } if (glyphState == GlyphState.Appearing) { glowVal += Time.deltaTime * GLYPH_RATE; if (glowVal >= 1.0f) { glowVal = 1.0f; glyphState = GlyphState.None; } mat.SetColor("_EmissionColor", new Color(1.0f, 1.0f, 1.0f, 1.0f) * glowVal); } else if (glyphState == GlyphState.Disappearing) { glowVal -= Time.deltaTime * GLYPH_RATE; if (glowVal <= 0) { glowVal = 0; glyphState = GlyphState.None; } mat.SetColor("_EmissionColor", new Color(1.0f, 1.0f, 1.0f, 1.0f) * glowVal); } }