private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { fpController.FreezeMovement(); mouseLookX.SetSensitivity(0f); mouseLookY.SetSensitivity(0f); FadeOutBGSound(); } }
// Use this for initialization void Start() { fpController.FreezeMovement(); mouseLookX.SetSensitivity(0f); mouseLookY.SetSensitivity(0f); fadeScript.fadeImage.color = fadeInColor; if (backgroundHumAudio) { bgVolume = backgroundHumAudio.volume; backgroundHumAudio.volume = 0f; } Invoke("BeginFade", fadeDelay); Invoke("FadeInBGSound", bgSoundFadeDelay); Invoke("Unfreeze", timeToUnfreeze); }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { Vector3 rayOrigin = fpCamera.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 0f)); RaycastHit hit; if (Physics.Raycast(rayOrigin, fpCamera.transform.forward, out hit, pickupRange)) { if (hit.collider.tag == "CanPickup") { ObjectController objScript = hit.collider.gameObject.GetComponent <ObjectController>(); PulsatingGlow glowScript = hit.collider.gameObject.GetComponent <PulsatingGlow>(); if (objScript) { if (!objScript.inspectMode) { //Debug.Log("picking up " + objScript.gameObject.name); objScript.StartInspectingObject(inspectPos, transform); mouseLookX.SetSensitivity(0f); mouseLookY.SetSensitivity(0f); if (fpController) { fpController.FreezeMovement(); } if (blurFader) { blurFader.BlurFadeIn(); } if (cursorImage) { cursorImage.enabled = false; } if (glowScript) { glowScript.StopGlowing(); } } else if (objScript.inspectTimer >= minInspectDuration) { //Debug.Log("putting down " + objScript.gameObject.name); objScript.StopInspectingObject(); mouseLookX.ResetSensitivity(); mouseLookY.ResetSensitivity(); if (fpController) { fpController.UnfreezeMovement(); } if (blurFader) { blurFader.BlurFadeOut(); } if (cursorImage) { cursorImage.enabled = true; } } } else { Debug.LogError("object does not have an attached ObjectController!"); } } } } }