public void Update(float time, GuitarSustainHitKnowledge sustainKnowledge, uint noteStreak) { var currentSustains = sustainKnowledge.currentSustains; int inputMask = GuitarInput.GetFretInputMask(); int extendedSustainsMask = sustainKnowledge.extendedSustainsMask; int shiftCount; int shiftedExtendedSustainsMask = GameplayInputFunctions.BitshiftToIgnoreLowerUnusedFrets(extendedSustainsMask, out shiftCount); foreach (GuitarSustainHitKnowledge.SustainKnowledge sustain in currentSustains.ToArray()) // Take a copy so we can remove as we go { if (noteStreak == 0) { BreakSustain(time, sustain); } else if (extendedSustainsMask != 0) { int shiftedInputMask = inputMask >> shiftCount; if ((shiftedInputMask & ~shiftedExtendedSustainsMask) != 0) { BreakSustain(time, sustain); } } else if (!GameplayInputFunctions.ValidateFrets(sustain.note, inputMask, noteStreak)) { BreakSustain(time, sustain); } } }
public void Update(float time, HitWindow <GuitarNoteHitKnowledge> hitWindow, uint noteStreak, GuitarSustainHitKnowledge sustainKnowledge) { // Capture input bool strum = GuitarInput.GetStrumInput(); int inputMask = GuitarInput.GetFretInputMask(); if (inputMask != previousInputMask) { canTap = true; } if (strum) { WriteInputToChart(time, inputMask); } // What note is the player trying to hit next? GuitarNoteHitKnowledge nextNoteToHit = hitWindow.oldestUnhitNote; UpdateNoteKnowledge(time, hitWindow, inputMask, strum, noteStreak, nextNoteToHit, sustainKnowledge); if (nextNoteToHit != null) { Note nextSeperate = nextNoteToHit.note.nextSeperateNote; if (noteStreak > 0) { PreserveStreakDetect(time, hitWindow, strum, noteStreak, nextNoteToHit, inputMask); } else { RecoveryDetect(time, hitWindow, inputMask, strum, noteStreak); } } // No note in window else { BlankWindowDetect(time, strum); } previousInputMask = inputMask; }