IEnumerator UpdateColorForMidiEventWithDelay(MidiEvent e, float lookahead, MIDICounter source)
    {
        yield return new WaitForSeconds (lookahead);

        SynchronizedMIDISwapper swapper = GameObject.Find ("MidiManager").GetComponent<SynchronizedMIDISwapper> ();

        if (swapper.ActiveMIDICounter () == source) {
            SongData.BeatType beatType = SongData.BeatType.None;
            if (e.data1 == onBeatNote)
                beatType = SongData.BeatType.OnBeat;
            else if (e.data1 == offBeatNote)
                beatType = SongData.BeatType.OffBeat;
            else if (e.data1 == syncoBeatNote)
                beatType = SongData.BeatType.SyncoBeat;

            Color c = ShipViewModel.ColorForBeatType (beatType);

            gameObject.GetComponent<SpriteRenderer> ().material.color = c;
        }
    }
 public override bool RespondsToMidiEvent(MidiEvent e, MIDICounter source)
 {
     return e.status == 144;
 }
 public override void HandleMidiEvent(MidiEvent e, float lookaheadSeconds, MIDICounter source)
 {
     StartCoroutine(UpdateColorForMidiEventWithDelay (e, lookaheadSeconds, source));
 }
Esempio n. 4
0
 public abstract bool RespondsToMidiEvent(MidiEvent e, MIDICounter source);
Esempio n. 5
0
 public abstract void HandleMidiEvent(MidiEvent e, float lookaheadSeconds, MIDICounter source);
Esempio n. 6
0
 public override void HandleMidiEvent(MidiEvent e, float lookaheadSeconds, MIDICounter source)
 {
     currentCoroutine = AddMidiEventWithTimeBoundaries (e, lookaheadSeconds - leadingCushionSeconds, lookaheadSeconds + trailingCushionSeconds);
     StartCoroutine (currentCoroutine);
 }