public static float GetInputValue(eInput input, int index = -1) { if (index >= ControlSetCount || index < -1) { Logger.LogError($"GetInputValue called with index({index}) out of range"); } float value = 0; int count = 0; for (int loop = 0; loop < ControlSetCount; loop++) { if (ControlSets[loop].GetInputActive(input) && (index == -1 || index == loop)) { value += ControlSets[loop].GetInputValue(input); count += 1; } } if (count == 0) { return(value); } return(value / count); }
public bool GetInputActive(eInput input) { if (!Theatre.CanPlayersMove()) { return(false); } return(SimpleInput.GetInputActive(input, index: ControlType)); }
public float GetInputValue(eInput input) { if (!Theatre.CanPlayersMove()) { return(0f); } return(SimpleInput.GetInputValue(input, index: ControlType)); }
public bool IsInputInState(eInput input, eButtonState state) { if (!Theatre.CanPlayersMove()) { return(false); } return(SimpleInput.IsInputInState(input, state, index: ControlType)); }
public bool IsKeyReleased(eInput key) { if (keys[(int)key]) { UpdateKey(key); if (!keys[(int)key]) { return(true); } } UpdateKey(key); return(false); }
public static bool IsInputInState(eInput input, eButtonState state, int index = -1) { if (index >= ControlSetCount || index < -1) { Logger.LogError($"IsInputInState called with index({index}) out of range"); } for (int loop = 0; loop < ControlSetCount; loop++) { if (ControlSets[loop].GetInputState(input) == state && (index == -1 || index == loop)) { return(true); } } return(false); }
public static bool GetInputActive(eInput input, int index = -1) { if (index >= ControlSetCount || index < -1) { Logger.LogError($"GetInputActive called with index({index}) out of range"); return(false); } for (int loop = 0; loop < ControlSetCount; loop++) { if (ControlSets[loop].GetInputActive(input) && (index == -1 || index == loop)) { return(true); } } return(false); }
private void UpdateKey(eInput key) { if (key == eInput.UP) { #if PSM if (GamePad.GetState(0).DPad.Up == ButtonState.Pressed) #else if (Keyboard.GetState().IsKeyDown(Keys.W)) #endif { keys[(int)key] = true; } else { keys[(int)key] = false; } return; } if (key == eInput.LEFT) { #if PSM if (GamePad.GetState(0).DPad.Left == ButtonState.Pressed) #else if (Keyboard.GetState().IsKeyDown(Keys.A)) #endif { keys[(int)key] = true; } else { keys[(int)key] = false; } return; } if (key == eInput.DOWN) { #if PSM if (GamePad.GetState(0).DPad.Down == ButtonState.Pressed) #else if (Keyboard.GetState().IsKeyDown(Keys.S)) #endif { keys[(int)key] = true; } else { keys[(int)key] = false; } return; } if (key == eInput.RIGHT) { #if PSM if (GamePad.GetState(0).DPad.Right == ButtonState.Pressed) #else if (Keyboard.GetState().IsKeyDown(Keys.D)) #endif { keys[(int)key] = true; } else { keys[(int)key] = false; } return; } if (key == eInput.PRIMARY) { #if PSM if (GamePad.GetState(0).Buttons.A == ButtonState.Pressed) #else if (Keyboard.GetState().IsKeyDown(Keys.Space)) #endif { keys[(int)key] = true; } else { keys[(int)key] = false; } return; } if (key == eInput.SECONDARY) { if (Keyboard.GetState().IsKeyDown(Keys.X)) { keys[(int)key] = true; } else { keys[(int)key] = false; } return; } }
public bool IsKeyDown(eInput key) { UpdateKey(key); return(keys[(int)key]); }
public float GetInputValue(eInput input) { return(Buttons[input].Value); }
public bool GetInputActive(eInput input) { return(Buttons[input].Active); }
public float GetTimeInState(eInput input) { return(Buttons[input].TimeInState); }
public eButtonState GetInputState(eInput input) { return(Buttons[input].State); }