Beispiel #1
0
    void OnEnable()
    {
        Debug.Log("audio!");
        starsBtn.gameObject.SetActive(false);
        feedbackBtn.gameObject.SetActive(false);
        rg = new RhythmGenerate();
        List <Note> rep = rg.getRepeatedRhythm(Globals.Instance.getRhythm(), Globals.Instance.getRepititions());

        noteDurations = rg.computeNoteDurations(rep);
        first         = true;
        clapIndex     = 0;
        totalClaps    = noteDurations.Count;
        timestamps    = new List <double>();
        _audio        = GetComponent <AudioSource>();
        StartCoroutine(SoundOut());
        //this.enabled = false;
    }
Beispiel #2
0
 void OnEnable()
 {
     if (inprogress)
     {
         return;  // already in progress
     }
     Metronome.gameObject.SetActive(true);
     feedbackBtn.gameObject.SetActive(false);
     starsBtn.gameObject.SetActive(false);
     rg              = new RhythmGenerate();
     rhythm          = rg.getRepeatedRhythm(Globals.Instance.curRhythm, Globals.Instance.getRepititions());
     noteIndex       = 0;
     noteRatings     = Enumerable.Repeat(Rating.MISSED, rhythm.Count).ToList();
     expNoteTimes    = rg.computeExpectedNoteTimes(rhythm);
     rhythmStartTime = -1;
     timestamps      = new List <double>();
     _audio          = GetComponent <AudioSource>();
     inprogress      = true;
     window          = 1; // stop accepting taps x seconds after last tap was supposed to occur
 }