public void Update(float time, GuitarSustainHitKnowledge sustainKnowledge, GamepadInput guitarInput, uint noteStreak)
    {
        var currentSustains = sustainKnowledge.currentSustains;

        int inputMask            = guitarInput.GetFretInputMaskControllerOrKeyboard();
        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);
            }
        }
    }
예제 #2
0
    public void Update(float time, HitWindow <GuitarNoteHitKnowledge> hitWindow, GamepadInput guitarInput, uint noteStreak, GuitarSustainHitKnowledge sustainKnowledge)
    {
        // Capture input
        bool strum     = guitarInput.GetStrumInputControllerOrKeyboard();
        int  inputMask = guitarInput.GetFretInputMaskControllerOrKeyboard();

        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;
    }