/// <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 }