Example #1
0
    private IEnumerator StartingUp()
    {
        yield return(null);

        staff.GetComponent <StaffScript>().ShowClef(nextNote.clef);
        yield return(new WaitForSeconds(1));        //to allow staffScript to wake up!

        staff.GetComponent <StaffScript>().ShowNote(nextNote.position, nextNote.sharp, nextNote.flat, nextNote.clef);
        StartCoroutine(noteController.Fade(noteMaterial, clefMaterial, noteDelay, false, colourController.getItem()));
        yield return(new WaitForSeconds(1));

        nextNoteTime     = Time.time + noteDelay;
        currentBeat      = 1;
        countInText.text = currentBeat.ToString();
        flashController.StartFlash(2);
        while (currentBeat <= 4)
        {
            if (isPaused)
            {
                nextNoteTime += Time.deltaTime;
            }
            if (NextBeat())
            {
                currentBeat++;

                if (currentBeat <= 4)
                {
                    countInText.text = currentBeat.ToString();
                    flashController.StartFlash(currentBeat);
                }
            }

            yield return(null);
        }
        currentBeat      = 1;
        startup          = false;
        countInText.text = "Go!";
        lastNote         = nextNote;
        nextNote         = NextNote();
        flashController.StartFlash(currentBeat);
        StartCoroutine(noteController.Fade(noteMaterial, clefMaterial, noteDelay, nextNote.clef != lastNote.clef, colourController.getBG()));
        yield return(new WaitForSeconds(2));

        countInText.text = "";
        if (timeLeft <= 600f)
        {
            displayTimer = true;
        }
    }