//maxens dubois //get the 2d vector void UpdateStickDirection() { if (XboxController.IsConnected) { stickDirection = XboxController.GetDirection(Inputs.move.xbox); } else { stickDirection = Inputs.move.keyboard(this.Team).GetDirection(); } }
public static InputDirection.Direction GetDirection(XBOX_DIRECTION direction, GamePadState pad) { InputDirection.Direction d = new InputDirection.Direction(0, 0); if (!pad.IsConnected) { return(d); } switch (direction) { case XBOX_DIRECTION.Pad: if (pad.DPad.Down == ButtonState.Pressed) { d.y--; } if (pad.DPad.Up == ButtonState.Pressed) { d.y++; } if (pad.DPad.Right == ButtonState.Pressed) { d.x++; } if (pad.DPad.Left == ButtonState.Pressed) { d.x--; } break; case XBOX_DIRECTION.StickLeft: d.x = pad.ThumbSticks.Left.X; d.y = pad.ThumbSticks.Left.Y; break; case XBOX_DIRECTION.StickRight: d.x = pad.ThumbSticks.Right.X; d.y = pad.ThumbSticks.Right.Y; break; } return(d); }
public static InputDirection.Direction GetDirection(XBOX_DIRECTION direction, GamePadState pad) { InputDirection.Direction d = new InputDirection.Direction(0, 0); if (!pad.IsConnected) { return d; } switch (direction) { case XBOX_DIRECTION.Pad: if (pad.DPad.Down == ButtonState.Pressed) d.y--; if (pad.DPad.Up == ButtonState.Pressed) d.y++; if (pad.DPad.Right == ButtonState.Pressed) d.x++; if (pad.DPad.Left == ButtonState.Pressed) d.x--; break; case XBOX_DIRECTION.StickLeft: d.x = pad.ThumbSticks.Left.X; d.y = pad.ThumbSticks.Left.Y; break; case XBOX_DIRECTION.StickRight: d.x = pad.ThumbSticks.Right.X; d.y = pad.ThumbSticks.Right.Y; break; } return d; }
//maxens dubois //get the 2d vector void UpdateStickDirection() { if (XboxController.IsConnected) { stickDirection = XboxController.GetDirection(Inputs.move.xbox); } else { stickDirection = Inputs.move.keyboard(this.Team).GetDirection(); } }