private static IEnumerator RecordAllLevels(RecorderLevelEntryPoint entry) { LevelData[] levels = LevelSettings.GetAllLevelDataOfType(LevelType.Recorded); // Record each level in turn foreach (LevelData level in levels) { yield return(RecordOneLevel(level, entry)); } // Show UI to state that entry.StartingUI.SetActive(true); entry.LevelTitle.text = "All done!"; entry.CountdownText.text = ""; }
public static void Start() { RecorderLevelEntryPoint scheduler = Object.FindObjectOfType <RecorderLevelEntryPoint>(); if (scheduler) { // Unlock all operations PlayerData.UnlockAllOperations(); // Make recorder verbose to show more information RecorderOptions.VerboseMode = true; // Do something to stop the music MusicManager.MusicSource.Stop(); // Record all of the levels scheduler.StartCoroutine(RecordAllLevels(scheduler)); } }
private static IEnumerator RecordOneLevel(LevelData level, RecorderLevelEntryPoint entry) { // Enable the starting UI entry.StartingUI.SetActive(true); entry.LevelTitle.text = $"Next Level: '{level.Name}'"; for (int i = entry.CountdownTime; i >= 1; i--) { entry.CountdownText.text = i.ToString(); // Set time of current count and create a function to detect when one second has passed yield return(new WaitForSeconds(1f)); } // Setup the matrix entry.StartingUI.SetActive(false); entry.MatrixUI.Setup(level); // Start the recording RecorderController recorder = GetRecorder(level.Name); recorder.PrepareRecording(); if (!recorder.StartRecording()) { Debug.Log("Failed to start the recording!"); } // Wait until the current matrix is identity yield return(new WaitUntil(() => entry.MatrixUI.CurrentMatrix.isIdentity)); yield return(new WaitForSeconds(entry.EndingTime)); // Stop the recording recorder.StopRecording(); }