private IEnumerator StartPhase() { // Make sure the Outro UI is not being shown and the intro UI is. StartCoroutine(m_UIController.ShowIntroUI()); StartCoroutine(m_UIController.HideOutroUI()); m_CameraContainer.transform.position = new Vector3(0, 0, 0); // To make sure the user is facing the right way show the arrows. m_GuiArrows.Show(); // Turn off the fog whilst showing the intro. RenderSettings.fog = false; // Make sure the game is stopped for the flyer's health. m_HealthController.StopGame(); // Since a selection slider is being used, hide the radial and show the reticle. m_SelectionSlider.gameObject.SetActive(true); m_SelectionRadial.Hide(); m_Reticle.Show(); m_FlyerMovementController.m_Speed = 70f; m_flyerPlayership.SetActive(false); // The user should hold Fire1 for the selection slider so turn on warnings for tapping. m_InputWarnings.TurnOnDoubleTapWarnings(); m_InputWarnings.TurnOnSingleTapWarnings(); // In order wait for the selection slider to fill, then the intro UI to hide, then the camera to fade out. yield return(StartCoroutine(m_SelectionSlider.WaitForBarToFill())); yield return(StartCoroutine(m_UIController.HideIntroUI())); yield return(StartCoroutine(m_CameraFade.BeginFadeOut(m_IntroOutroFadeDuration, false))); // Once the screen has faded out, we can hide UI elements we don't want to see anymore like the arrows and reticle. m_GuiArrows.Hide(); m_Reticle.Hide(); // Turn the fog back on so spawned objects won't appear suddenly. RenderSettings.fog = true; // The user now needs to tap to fire so turn off the warnings. m_InputWarnings.TurnOffDoubleTapWarnings(); m_InputWarnings.TurnOffSingleTapWarnings(); // Now wait for the screen to fade back in. yield return(StartCoroutine(m_CameraFade.BeginFadeIn(m_IntroOutroFadeDuration, false))); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Alpha1) == true && targetOneFadedOut && loadScene == null) { currentTarget = 1; loadScene = SceneManager.LoadSceneAsync(2); loadScene.allowSceneActivation = false; } if (Input.GetKeyDown(KeyCode.Alpha2) == true && targetTwoFadedOut && loadScene == null) { currentTarget = 2; loadScene = SceneManager.LoadSceneAsync(2); loadScene.allowSceneActivation = false; } if (loadScene != null) { if (loadScene.progress >= 0.9f && targetOneFadedOut && targetTwoFadedOut) { switch (currentTarget) { case 1: targetOne.SetActive(true); targetOneImage.CrossFadeAlpha(1.0f, 1.0f, true); targetOneFadedOut = false; guiArrows.SetDesiredDirection(targetTwo.transform); //set initial direction to target two to get user to look at target one guiArrows.Show(); break; case 2: targetTwo.SetActive(true); targetTwoImage.CrossFadeAlpha(1.0f, 1.0f, true); targetTwoFadedOut = false; guiArrows.SetDesiredDirection(targetOne.transform); //set initial direction to target one to get user to look at target one guiArrows.Show(); break; default: Debug.Log("No target selected"); break; } } if (loadScene.progress >= 0.9f && Input.GetKeyDown(KeyCode.Alpha5)) { loadScene.allowSceneActivation = true; } Debug.Log("progress: " + loadScene.progress); } }
private IEnumerator StartPhase() { // Make sure the Outro UI is not being shown and the intro UI is. StartCoroutine(m_UIController.ShowIntroUI()); StartCoroutine(m_UIController.HideOutroUI()); // To make sure the user is facing the right way show the arrows. m_GuiArrows.Show(); // Turn off the fog whilst showing the intro. RenderSettings.fog = false; // Make sure the game is stopped for the flyer's health. m_HealthController.StopGame(); // Since a selection slider is being used, hide the radial and show the reticle. m_SelectionRadial.Hide(); m_Reticle.Show(); // In order wait for the selection slider to fill, then the intro UI to hide, then the camera to fade out. yield return(StartCoroutine(m_SelectionSlider.WaitForBarToFill())); yield return(StartCoroutine(m_UIController.HideIntroUI())); yield return(StartCoroutine(m_CameraFade.BeginFadeOut(m_IntroOutroFadeDuration, false))); // Once the screen has faded out, we can hide UI elements we don't want to see anymore like the arrows and reticle. m_GuiArrows.Hide(); m_Reticle.Hide(); // Turn the fog back on so spawned objects won't appear suddenly. RenderSettings.fog = true; // Now wait for the screen to fade back in. yield return(StartCoroutine(m_CameraFade.BeginFadeIn(m_IntroOutroFadeDuration, false))); }
// Update is called once per frame void Update() { switch (SceneManager.GetActiveScene().buildIndex) { case 0: //Start break; case 1: //Lobby if (targetOneFadedOut && targetTwoFadedOut && conditions.Count > 0) { if (runNumber > 1 && !onBreak) { targetOne.SetActive(true); targetOneImage.CrossFadeAlpha(1.0f, 1.0f, true); targetOneFadedOut = false; guiArrows.SetDesiredDirection(targetTwo.transform); //set initial direction to target two to get user to look at target one guiArrows.Show(); } else if (!onBreak) { if (runNumber % 2 == 0) { targetTwo.SetActive(true); targetTwoImage.CrossFadeAlpha(1.0f, 1.0f, true); targetTwoFadedOut = false; guiArrows.SetDesiredDirection(targetOne.transform); //set initial direction to target one to get user to look at target one guiArrows.Show(); } else { targetOne.SetActive(true); targetOneImage.CrossFadeAlpha(1.0f, 1.0f, true); targetOneFadedOut = false; guiArrows.SetDesiredDirection(targetTwo.transform); //set initial direction to target two to get user to look at target one guiArrows.Show(); } } } else if (conditions.Count == 0) { finishedInstructions.SetActive(true); } break; case 2: //City if (timer < trafficLightChangeDelay && controller != null) { controller.toggle(trafficLightYellowInterval, vehicleClearanceInterval); trafficLightChangeDelay = -999f; } if (timer > 0) { timer = timer - Time.deltaTime; } break; default: break; } if (Input.GetButtonDown("Cancel")) { Application.Quit(); } }