IEnumerator DisplaySpectreForTimeDelay(float time) { // Restore to previous state, which was probably disabled. Could generate race condition... //var wasEnabled = clueCamera.isEnabled; clueCamera.EnableCamera(true); spectreRenderer.enabled = true; yield return(new WaitForSeconds(0.5f)); var playSeriesOfAudioClips = GetComponent <PlaySeriesOfAudioClips>(); if (playSeriesOfAudioClips != null) { playSeriesOfAudioClips.PlaySeries(); } yield return(new WaitForSeconds(playSeriesOfAudioClips.GetClipsLength() / 2.0f)); spectreRenderer.enabled = false; clueCamera.EnableCamera(false); if (!nextClue.activeSelf) { nextClue.SetActive(true); } if (nextClue.GetComponent <ClueController>() != null) { nextClue.GetComponent <ClueController>().enableClue(); } }
void ViewClue() { // Disable player fPSController.InputControl(false); //disable scene time //Time.timeScale = 0; isViewingClue = true; originalBounds = transform.Find("CenterPoint").GetComponentInChildren <Renderer>().bounds.size; originalSize = Mathf.Max(originalBounds.x, originalBounds.y, originalBounds.z); if (allowRotation || allowScale) { Debug.Log("Object size is " + originalSize); transform.position = Camera.main.transform.position + Camera.main.transform.forward * 1; float scaleFactor = targetSize / originalSize; Debug.Log("scaleFactor is " + scaleFactor); Vector3 newScale = new Vector3(originalScale.x * scaleFactor, originalScale.y * scaleFactor, originalScale.z * scaleFactor); transform.localScale = newScale; Debug.Log("newScale is " + newScale); } else { fPSController.CameraTarget(transform.Find("CenterPoint").gameObject); } releaseTime = Time.realtimeSinceStartup + minTimeToHoldItem; clueCameraTracker.EnableCamera(true); }