Exemplo n.º 1
0
        public bool Matches(InputHelper.CommandMove command)
        {
            InputHelper.KeyState previousKeyState = command.GetPreviousMove();
            InputHelper.KeyState currentKeyState = command.GetCurrentMove();
            InputBuffer currentBuffer = GetNextBuffer(currentKeyState);

            if (currentKeyState.GetState() != InputHelper.ButtonState.Held)
            {
                if (command.IsMaxNegativeReached() == true)
                {
                    command.Reset();
                    return false;
                }
                
                if (currentBuffer.GetCurrentInputState() == currentKeyState.GetKey())
                {
                    command.Next();

                    if (command.GetCurrentMoveStep() >= command.GetMoves().Count - 1)
                    {
                        currentKeyState = command.GetMoves()[command.GetMoves().Count - 1];
                    }
                    else
                    {
                        currentKeyState = command.GetCurrentMove();
                    }

                    currentBuffer = GetNextBuffer(currentKeyState);
                    Debug.WriteLine("NEXT BUFFER: " + currentKeyState.GetState());
                }
                else
                {
                    command.IncrementNegativeCount();
                }
            }
            else
            {
                Debug.WriteLine("IN HELD");
                checkHeld(command, currentKeyState);
            }

            if (command.IsComplete())
            {
                Debug.WriteLine("IS COMPLETE");
                command.Reset();
                ResetBuffers();
                return true;
            }

            return false;
        }