IEnumerator winCountDown() { if (player1score > player2score) { playerWinningTextD1.text = "Green Holds All Holofields"; playerWinningTextD2.text = "Green Holds All Holofields"; playerWinningTextD3.text = "Green Holds All Holofields"; } else if (player2score > player1score) { playerWinningTextD1.text = "Blue Holds All Holofields"; playerWinningTextD2.text = "Blue Holds All Holofields"; playerWinningTextD3.text = "Blue Holds All Holofields"; } while (winCountDownTime >= 0 && isWinCountDownActive && !stopWinCountDown) { yield return(new WaitForSeconds(1)); winCountDownTime--; ToggleUIText3(winCountDownTextD1, winCountDownTextD2, winCountDownTextD3, winCountDownTime); if (winCountDownTime <= 5) { if (winCountDownTime == 5) { CVCvalue = 0; } CVC.setValue(CVCvalue); if (CVCvalue < 6) { CVCvalue = CVCvalue + 1; } Countdown.start(); } } if (winCountDownTime < 1 && !stopWinCountDown) { Time.timeScale = 0; WinScreen(); } yield return(new WaitForEndOfFrame()); //yield return new WaitWhile(() => winCountDownTime >= 0); }
IEnumerator GameRoundCountdown() { while (roundCountdownTime > 0 && isGameRoundTimerRunning) { yield return(new WaitForSeconds(1)); roundCountdownTime--; ToggleUIText3(roundCountdownText_D1, roundCountdownText_D2, roundCountdownText_D3, roundCountdownTime); if (roundCountdownTime <= 5) { if (roundCountdownTime == 5) { CVCvalue = 0; } CVC.setValue(CVCvalue); if (CVCvalue < 6) { CVCvalue = CVCvalue + 1; } Countdown.start(); } } if (roundCountdownTime <= 0 && player1score == player2score) { isGameRoundTimerRunning = false; StartCoroutine(Overtime()); } else if (roundCountdownTime <= 0) { isGameRoundTimerRunning = false; Time.timeScale = 0; WinScreen(); } yield return(new WaitForEndOfFrame()); }