IEnumerator Play() { while (progress < songTime.Count) { animecontrol.Reset(); for (int j = 0; j < songTime[progress].Count; j++) { state = 0; GetComponent <AudioSource>().Stop(); iPlayer = -1; jPlayer = -1; ComPlay(ConvertPitch(songPitch[progress][j]), 1f); yield return(new WaitForSecondsRealtime(unitTime * NOTES[int.Parse(songTime[progress][j])])); com.Stop(); comAnimeControl.Reset(); } yield return(new WaitForSecondsRealtime(60 / bpm)); EffectPlay(1); correct = 0; wrong = 0; yield return(new WaitForSecondsRealtime(0.2f)); for (int j = 0; j < songTime[progress].Count; j++) { state = 1; noteStamp = Time.realtimeSinceStartup; iPlayer = progress; jPlayer = j; yield return(new WaitForSecondsRealtime(unitTime * NOTES[int.Parse(songTime[progress][j])])); if (state == 1) { EffectPlay(0); animecontrol.Fail(); wrong++; } } if (correct > wrong) { EffectPlay(2); animecontrol.Sing(); } else { EffectPlay(3); animecontrol.Fail(); } yield return(new WaitForSecondsRealtime(60 / bpm)); progress++; } }