public GuitarGameplayRulestate(MissFeedback missFeedbackFn) : base(missFeedbackFn) { hitAndMissNoteDetect = new GuitarNoteHitAndMissDetect(HitNote, MissNote); sustainBreakDetect = new GuitarSustainBreakDetect(SustainBreak); guitarSustainHitKnowledge = new GuitarSustainHitKnowledge(); guitarWhammyDetect = new GuitarWhammyDetect(); }
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, GuitarSustainHitKnowledge sustainKnowledge) { var currentSustains = sustainKnowledge.currentSustains; float whammyValue = GuitarInput.GetWhammyInput(); foreach (var sustain in currentSustains) { foreach (Note note in sustain.note.chord) { NoteController nCon = note.controller; if (nCon != null) { nCon.SetDesiredWhammy(whammyValue); } } } }
void UpdateNoteKnowledge(float time, HitWindow <GuitarNoteHitKnowledge> hitWindow, int inputMask, bool strummed, uint noteStreak, GuitarNoteHitKnowledge nextNoteToHit, GuitarSustainHitKnowledge sustainKnowledge) { // Check if it's valid to query the last hit note if (noteStreak <= 0 || lastNoteHit == null || !hitWindow.IsWithinTimeWindow(lastNoteHit.note, nextNoteToHit != null ? nextNoteToHit.note : null, time)) { lastNoteHit = null; } if (nextNoteToHit != null && noteStreak > 0) // None of this knowledge should be used for recovery { if (nextNoteToHit.strumCounter > 1) { nextNoteToHit.strumCounter = 1; // Make this still valid to hit because it's still in the hit window for a reason } // Fill out note knowledge if (GameplayInputFunctions.ValidateFrets(nextNoteToHit.note, inputMask, noteStreak, sustainKnowledge.extendedSustainsMask)) { nextNoteToHit.fretValidationTime = time; } else { nextNoteToHit.lastestFretInvalidationTime = time; } if (GameplayInputFunctions.ValidateStrum(nextNoteToHit.note, canTap, strummed, noteStreak)) { nextNoteToHit.strumValidationTime = time; } else { nextNoteToHit.lastestStrumInvalidationTime = time; } if (strummed) { if (lastNoteHit != null && lastNoteHit.strumCounter <= 0)// lastNoteHit.note.type != Note.Note_Type.Strum) { ++lastNoteHit.strumCounter; } else { ++nextNoteToHit.strumCounter; } } } }
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; } // 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; }