public static PlayerActions CreateWithKeyboardBindings() { var actions = new PlayerActions(); actions.Green.AddDefaultBinding( Key.A ); actions.Red.AddDefaultBinding( Key.S ); actions.Blue.AddDefaultBinding( Key.D ); actions.Yellow.AddDefaultBinding( Key.F ); actions.Up.AddDefaultBinding( Key.UpArrow ); actions.Down.AddDefaultBinding( Key.DownArrow ); actions.Left.AddDefaultBinding( Key.LeftArrow ); actions.Right.AddDefaultBinding( Key.RightArrow ); return actions; }
public static PlayerActions CreateWithJoystickBindings() { var actions = new PlayerActions(); actions.Green.AddDefaultBinding( InputControlType.Action1 ); actions.Red.AddDefaultBinding( InputControlType.Action2 ); actions.Blue.AddDefaultBinding( InputControlType.Action3 ); actions.Yellow.AddDefaultBinding( InputControlType.Action4 ); actions.Up.AddDefaultBinding( InputControlType.LeftStickUp ); actions.Down.AddDefaultBinding( InputControlType.LeftStickDown ); actions.Left.AddDefaultBinding( InputControlType.LeftStickLeft ); actions.Right.AddDefaultBinding( InputControlType.LeftStickRight ); actions.Up.AddDefaultBinding( InputControlType.DPadUp ); actions.Down.AddDefaultBinding( InputControlType.DPadDown ); actions.Left.AddDefaultBinding( InputControlType.DPadLeft ); actions.Right.AddDefaultBinding( InputControlType.DPadRight ); return actions; }
void OnEnable() { InputManager.OnDeviceDetached += OnDeviceDetached; keyboardListener = PlayerActions.CreateWithKeyboardBindings(); joystickListener = PlayerActions.CreateWithJoystickBindings(); }
bool JoinButtonWasPressedOnListener( PlayerActions actions ) { return actions.Green.WasPressed || actions.Red.WasPressed || actions.Blue.WasPressed || actions.Yellow.WasPressed; }
private bool JoinButtonWasPressedOnListener(PlayerActions actions) { return(actions.Green.WasPressed || actions.Red.WasPressed || actions.Blue.WasPressed || actions.Yellow.WasPressed); }
private void OnEnable() { InputManager.OnDeviceDetached += OnDeviceDetached; keyboardListener = PlayerActions.CreateWithKeyboardBindings(); joystickListener = PlayerActions.CreateWithJoystickBindings(); }