IEnumerator Cutscene(string[] cutscene, int[] cam_positions, AudioClip[] lines) { yield return(new WaitForSeconds(delay)); foreach (string s in cutscene) { // clear box dialogueText.text = ""; spaceToContinue.StopBlinking(); // play dialogue GetComponent <AudioSource>().PlayOneShot(lines[i]); if (i == 9 && currentScene == Scene.beforeBossBattle) { bossAnim.SetInteger("state", 2); bossAnim.SetBool("isCutscene", false); } if (i == 0 && currentScene == Scene.afterBossBattle) { bossAnim.SetInteger("state", 2); bossAnim.SetBool("isCutscene", false); } if (i == 1 && currentScene == Scene.afterBossBattle) { bossAnim.SetBool("isCutscene", true); } // move camera if (i > 0) { if (cam_positions[i] != cam_positions[i - 1]) { cam.Trigger(cam_positions[i]); } } else { cam.Trigger(cam_positions[i]); } // reveal mask if (currentScene == Scene.afterBossBattle && i == 9) { face.SetActive(true); } i++; foreach (char c in s) { dialogueText.text += c; yield return(new WaitForSeconds(1 / textSpeed)); } spaceToContinue.StartBlinking(); while (!Input.GetKey(KeyCode.Space)) { yield return(new WaitForEndOfFrame()); } } BG.StartFade(0); yield return(new WaitForSeconds(3)); NextScene(); }