IEnumerator Start() { Debug.Log("Numero di players " + GameData.playerData?.Count); // Starting here the music (pregame clip) audio_backgroundMusic.Play(); // In this phase we're doing the countdown. See countdownmanager for this part yield return(StartCoroutine(countdownManager.Init())); // Here we spawn the players (and we switch camera), but you won't be able to move as we're still in countdown phase SpawnPlayers(); // Let's do five seconds of countdown yield return(StartCoroutine(countdownManager.Countdown())); // Brutally switching background music clip with the battle one audio_backgroundMusic.clip = mus_RoombaGame; audio_backgroundMusic.Play(); countdownManager.PlayGoSound(); // Enabling movement for each roomba foreach (PlayerController roomba in roombaPlayer) { roomba.EnableMovement(); yield return(null); } // Here we go with the standard game time yield return(StartCoroutine(LoopGame())); //yield return new WaitForSeconds(matchTimeDuration); Debug.Log("CAMADONNA E' FINITA"); audio_backgroundMusic.clip = sfx_BatteryDown; audio_backgroundMusic.loop = false; audio_backgroundMusic.Play(); foreach (PlayerController roomba in roombaPlayer) { roomba.DisableMovement(); } tilesManager.SaveFinalScore(); yield return(new WaitForSeconds(1)); countdownManager.PlayCameraEndCinematic(); yield return(new WaitForSeconds(2)); StartCoroutine(countdownManager.FadeOutCongrats(0.5f)); yield return(new WaitForSeconds(3)); yield return(StartCoroutine(countdownManager.FadeOut(1))); SceneManager.LoadScene(2); }