private bool CheckDirectionalPressedOnce(InputDirection direction, DirectionalInputTypes inputTypes,
Keys arrowKey, Keys WASDKey, Buttons leftThumbstick, Buttons rightThumbstick, Buttons dPadDirection)
{
bool hasAnyCommand = false;
if (inputTypes.HasFlag(DirectionalInputTypes.WASD))
{
if (Keyboard.IsKeyDown(WASDKey))
{
hasAnyCommand = true;
if (HoldDownPress(direction))
{
return true;
}
else
{
if (Keyboard.IsKeyDownOnce(WASDKey))
{
ChangePressedDirection(direction);
return true;
}
}
}
}
if (inputTypes.HasFlag(DirectionalInputTypes.ArrowKeys))
{
if (Keyboard.IsKeyDown(arrowKey))
{
hasAnyCommand = true;
if (HoldDownPress(direction))
{
return true;
}
else
{
if (Keyboard.IsKeyDownOnce(arrowKey))
{
ChangePressedDirection(direction);
return true;
}
}
}
}
if (inputTypes.HasFlag(DirectionalInputTypes.LeftThumbstick))
{
if (GamePad.IsButtonDown(leftThumbstick))
{
hasAnyCommand = true;
if (HoldDownPress(direction))
{
return true;
}
else
{
if (GamePad.IsButtonDownOnce(leftThumbstick))
{
ChangePressedDirection(direction);
return true;
}
}
}
}
if (inputTypes.HasFlag(DirectionalInputTypes.RightThumbstick))
{
if (GamePad.IsButtonDown(rightThumbstick))
{
hasAnyCommand = true;
if (HoldDownPress(direction))
{
return true;
}
else
{
if (GamePad.IsButtonDownOnce(rightThumbstick))
{
ChangePressedDirection(direction);
return true;
}
}
}
}
if (inputTypes.HasFlag(DirectionalInputTypes.DPad))
{
if (GamePad.IsButtonDown(dPadDirection))
{
hasAnyCommand = true;
if (HoldDownPress(direction))
{
return true;
}
else
{
if (GamePad.IsButtonDownOnce(dPadDirection))
{
ChangePressedDirection(direction);
return true;
}
}
}
}
if (!hasAnyCommand)
ResetPressedDirection(direction);
return false;
}