public bool DetermineButtonPress(KeyboardState presentState) { //A attack button pressed if (MoveInput.KeyboardPressed(presentState, lastKeyboardState, controlSetting.Controls["a"])) { System.Diagnostics.Debug.WriteLine("A button pressed"); return(true); } // B attack button pressed if (MoveInput.KeyboardPressed(presentState, lastKeyboardState, controlSetting.Controls["b"])) { System.Diagnostics.Debug.WriteLine("B button pressed"); return(true); } if (MoveInput.KeyboardPressed(presentState, lastKeyboardState, controlSetting.Controls["c"])) { System.Diagnostics.Debug.WriteLine("C button pressed"); return(true); } if (MoveInput.KeyboardPressed(presentState, lastKeyboardState, controlSetting.Controls["d"])) { System.Diagnostics.Debug.WriteLine("d button pressed"); return(true); } return(false); }
public bool DetermineJumpPress(KeyboardState presentState) { if (MoveInput.KeyboardPressed(presentState, lastKeyboardState, controlSetting.Controls["up"])) { Console.WriteLine("Jump Button"); return(true); } else { return(false); } }
public void enqueueState(KeyboardState state, Dictionary <string, Keys> controls) { keysPressed = new Keys[state.GetPressedKeys().Length]; int counter = 0; foreach (String attack in ATTACKS) { if (MoveInput.KeyboardPressed(state, lastKeyboardState, controls[attack])) { keysPressed[counter] = controls[attack]; counter++; } } foreach (String direction in DIRECTIONS) { if (state.IsKeyDown(controls[direction])) { keysPressed[counter] = controls[direction]; counter++; } } inputs.Enqueue(keysPressed); }
public String checkMoves(Direction direction, KeyboardState newKeyboardState, List <MoveInput> moveList, Boolean dashCancealable) { // on a button press determine if a special move was inputted. // if (DetermineButtonPress(newKeyboardState)) { // Reset our command index for every special move // foreach (MoveInput moveInput in moveList) { moveInput.resetCurrentInputCommandIndex(); } // Iterate through the input queue // foreach (Keys[] keyboardState in inputs) { // For every command // foreach (MoveInput moveInput in moveList) { // check to see if a pressed key in the current input state matches a necessary move input // if (MoveInput.checkStringInputToKeyInput(moveInput.InputCommand[moveInput.CurrentInputCommandIndex], keyboardState, direction, controlSetting.Controls)) { // Move up our command index for that move // moveInput.moveCurrentInputCommandIndex(); // If our command index for a move is greater than how many inputs it needs, we must have input it // if (moveInput.CurrentInputCommandIndex >= moveInput.InputCommand.Count) { lastKeyboardState = newKeyboardState; Console.WriteLine("Activating " + moveInput.Name); // Clear up our input queue // inputs.Reset(); return(moveInput.Name); } } } } } // Otherwise this is a movement special input like a dash // else if (dashCancealable) { // Atm we only really care about reading a dash // foreach (MoveInput dashInput in dashList) { dashInput.resetCurrentInputCommandIndex(); } foreach (Keys[] keyboardState in inputs.GetReverseEnumerator) { foreach (MoveInput dash in dashList) { if (MoveInput.checkStringInputToKeyInputForMovement(dash.InputCommand[dash.CurrentInputCommandIndex], keyboardState, direction, controlSetting.Controls)) { dash.moveCurrentInputCommandIndex(); if (dash.CurrentInputCommandIndex >= dash.InputCommand.Count) { System.Diagnostics.Debug.WriteLine(dash.Name); //inputs.Reset(); return(dash.Name); } } } } } lastKeyboardState = newKeyboardState; return(null); }