/// <summary> /// Play audio and display text. /// </summary> /// <returns></returns> private IEnumerator RayTextSequence() { // Disable interaction until Ray has left the player a puddle of emotions. InteractWithSelectedObject interactionScript = Camera.main.GetComponent <InteractWithSelectedObject>(); if (interactionScript != null && scanningCam != null) { interactionScript.enabled = false; scanningCam.SetActive(false); } // Clear text. textWriter.DisplayText(""); // Play audio clip. rayAudioSource.Play(); #region print Ray's sentimental message. :( // Adjust text speed to match audio clip (we are hardcoding this because Becca's talking speed changes from line to line). textWriter.ChangeTypingSpeed(17); textWriter.DisplayText(endingLines); yield return(new WaitForSeconds(18)); // Adjust text speed to match audio clip (we are hardcoding this because Becca's talking speed changes from line to line). textWriter.ChangeTypingSpeed(18); textWriter.DisplayText(endingLines2); yield return(new WaitForSeconds(17)); // Adjust text speed to match audio clip (we are hardcoding this because Becca's talking speed changes from line to line). textWriter.ChangeTypingSpeed(20); textWriter.DisplayText(endingLines3); #endregion while (rayAudioSource.isPlaying) { yield return(null); } // Enable interaction, so that the player can kill themself. if (interactionScript != null) { interactionScript.enabled = true; scanningCam.SetActive(true); } if (FinishedMessage != null) { FinishedMessage.Invoke(); } }
private Transform zoomLoc; // location of the focus point private void Start() { GameObject player = GameObject.FindWithTag("Player"); //gets the playerObject by Unity Default Tag "Player". controller = player.GetComponent <FirstPersonController>(); //gets the fps controller from the player object. raycast = player.GetComponentInChildren <InteractWithSelectedObject>(); zoomLoc = transform.GetChild(0); //gets the focus point transform by accesing the first child of the object. playerCamera = player.transform.GetChild(0); //gets the player camera by accesing the first child of the player. previousPosition = new Vector3(); previousRotation = new Quaternion(); //initializes the previous rotation to a heap data. Must be set on derived class when activated. }
// Use this for initialization void Start() { #region Defining Private Fields // Defines Camera, fpscontroller, and InteractionBehavior for roomba and player objects playerCam = player.GetComponentInChildren <Camera>(); roombaCam = roomba.GetComponentInChildren <Camera>(); playerController = player.GetComponent <CustomRigidbodyFPSController>(); roombaController = roomba.GetComponent <CustomRigidbodyFPSController>(); playerInteractionBehavior = player.GetComponentInChildren <InteractWithSelectedObject>(); roombaInteractionBehavior = roomba.GetComponentInChildren <InteractWithSelectedObject>(); playerDetectInteractionBehavior = player.GetComponentInChildren <DetectInteractableObject>(); roombaDetectInteractionBehavior = roomba.GetComponentInChildren <DetectInteractableObject>(); playerCanvas = player.GetComponentInChildren <Canvas>(); roombaCanvas = roomba.GetComponentInChildren <Canvas>(); playerBrackets = player.GetComponentInChildren <Brackets>(); roombaBrackets = roomba.GetComponentInChildren <Brackets>(); swapEnabled = false; #endregion // Sets the Roomba and player as active or inactive if (roombaIsActive) { ActivateRoomba(); } else // Sets roomba to inactive, player inactive { DeactivateRoomba(); } swapCanvas.enabled = false; }