private float m_timer; // Keep track of time between ball drop fails // Use this for initialization void Start() { // Make the script a singleton if (s_Instance == null) { s_Instance = this; m_Manager = IntroSessionManager.s_Instance; m_RaycasterScript = IntroSessionManager.s_RaycasterScript; m_timer = 0; // Spawn a ball for the user m_Manager.SpawnNewBall(); // Display text and playback audio for dialogue, then wait for the audio to finish before continuing m_Manager.GlobalMessage(m_DialogueInstructions.DialogueElements[0]); // Open the trap door and reset the timer Debug.Log("STAGE4 CALLING OPENING SLIDING DOORS"); m_Manager.OpenSlidingDoors(); } else { Destroy(gameObject); } }
/// <summary> /// Controls the flow of the scene. /// </summary> /// <returns>A reference to the coroutine</returns> private IEnumerator Run() { m_Manager.HighlightButtonOn(m_Manager.GetTriggerButton()); m_Manager.GlobalMessage(m_DialogueInstructions.DialogueElements[0]); // wait for half of the dialogue to play before beginning to open the doors yield return(new WaitForSeconds(m_DialogueInstructions.DialogueElements[0].PlayBackSoundFile.length / 2)); // Open the sliding doors and bring the box into the scene m_Manager.OpenSlidingDoors(); m_Manager.BringBoxIntoScene(); // Wait until audio finishes playing before moving the robot yield return(new WaitForSeconds(m_DialogueInstructions.DialogueElements[0].PlayBackSoundFile.length / 2 + 1f)); m_Manager.MoveRobotToPosition(c_RobotLocationNearButton); // Move the robot near the button }