Example #1
0
 private void OnGoodHit(Note note, float offset)
 {
     if(note != null) {
         note.OnNoteHit();
         Debug.Log("hit");
         _sceneManager.OnHit(offset, note.transform);
     }
     _lastNoteTime = -1.0f;
     _lastHitTime = -1.0f;
 }
Example #2
0
        public void OnNoteEndPointReached(Note note, float noteTime)
        {
            //Debug.Log("Note reached");
            float offset = noteTime - _lastHitTime;

            if(offset < _timeOffset) {
                _soundManager.PlayHitSound();
                OnGoodHit(note, offset);
            }
            else {
                if(_lastNote != null) {
                    _lastNote.OnNoteMissed();
                }
                _lastNoteTime = noteTime;
                _lastNote = note;
            }
        }
Example #3
0
        public void OnInstrumentHit(Instrument instrument, float hitTime)
        {
            float offset = hitTime - _lastNoteTime;

            if(offset < _timeOffset) {
                _soundManager.PlayHitSound();
                OnGoodHit(_lastNote, offset);
            }
            else {
                _soundManager.PlayMissSound();
                _lastHitTime = hitTime;
                if(_lastNote != null) {
                    Debug.Log("miss");
                    _lastNote.OnNoteMissed();
                    _lastNote = null;
                }
                _lastNoteTime = -1.0f;
            }
        }