private IEnumerator PlayPhase() { // The game is now running. m_IsGameRunning = true; // Start the various controllers. m_AlignmentChecker.StartGame(); m_HealthController.StartGame(); m_FlyerMovementController.StartGame(); m_EnvironmentController.StartEnvironment(); // The end of the game is the current time + the length of the game. m_EndTime = Time.time + m_GameDuration; // Each frame while the flyer is alive and there is time remaining... do { // Calculate the time remaining set the timer bar to fill by the normalised time remaining. m_TimeRemaining = m_EndTime - Time.time; m_TimerBar.fillAmount = m_TimeRemaining / m_GameDuration; // Wait until the next frame. yield return(null); }while (m_TimeRemaining > 0f && !m_HealthController.IsDead); // Upon reaching this point either the time has run out or the flyer is dead, either way the game is no longer running. m_IsGameRunning = false; }
private IEnumerator PlayPhase() { // The game is now running. m_IsGameRunning = true; m_flyerPlayership.SetActive(true); m_SelectionSlider.gameObject.SetActive(false); m_SwimAudioEvent.Play(); // Start the game audio. foreach (var audioEvent in m_AudioEventArray) { audioEvent.GetComponent <AudioSource>().PlayDelayed(m_PlaybackDelayTime); } // Start the various controllers. m_AlignmentChecker.StartGame(); m_HealthController.StartGame(); m_FlyerMovementController.StartGame(); m_EnvironmentController.StartEnvironment(); // The end of the game is the current time + the length of the game. m_EndTime = Time.time + m_GameDuration; // Each frame while the flyer is alive and there is time remaining... do { // Calculate the time remaining set the timer bar to fill by the normalised time remaining. m_TimeRemaining = m_EndTime - Time.time; m_TimerBar.fillAmount = m_TimeRemaining / m_GameDuration; //m_TimerBar.rectTransform.sizeDelta = new Vector2(m_TimeRemaining / m_GameDuration * 1200, 100); // Wait until the next frame. yield return(null); }while (m_TimeRemaining > 0f && !m_HealthController.IsDead); // Upon reaching this point either the time has run out or the flyer is dead, either way the game is no longer running. m_IsGameRunning = false; }