IEnumerator PlayGameRoutine() { // if level is timed, start the timer if (m_levelGoalTimed != null) { m_levelGoalTimed.StartCountdown(); } // while the end game condition is not true, we keep playing // just keep waiting one frame and checking for game conditions while (!m_isGameOver) { m_isGameOver = m_levelGoal.IsGameOver(); m_Winner = m_levelGoal.GetWinner(); // wait one frame yield return(null); } }