private float GetValueFromAxisType(PlayerIndex playerNumber, InputAxisType type) { switch (type) { case InputAxisType.LeftStickX: return(Input.GamePad(playerNumber).LeftThumbstickX); case InputAxisType.LeftStickY: return(Input.GamePad(playerNumber).LeftThumbstickY); case InputAxisType.RightStickX: return(Input.GamePad(playerNumber).RightThumbstickX); case InputAxisType.RightStickY: return(Input.GamePad(playerNumber).RightThumbstickY); case InputAxisType.LeftTrigger: return(Input.GamePad(playerNumber).LeftTrigger); case InputAxisType.RightTrigger: return(Input.GamePad(playerNumber).RightTrigger); default: return(0); } }
public InputAxis RemoveAxis(InputAxisType type) { var a = Get(type); if (a != null) { axes.Remove(a); } return(this); }
internal InputAxisBase Get(InputAxisType type) { foreach (var axis in axes) { if (axis.GetType() == typeof(InputAxisOfType)) { var t = axis as InputAxisOfType; if (t != null) { if (t.type == type) { return(t); } } } } return(null); }
public InputAxis GetAxis( string axisID, InputAxisType axisType = InputAxisType.Mouse ) { InputAxis newAxis = inputAxes.Find( axis => axisID == axis.Name ); if( newAxis == null ) { if( axisType == InputAxisType.Mouse ) newAxis = new MouseInputAxis(); else if( axisType == InputAxisType.Keyboard ) newAxis = new KeyboardInputAxis(); else if( axisType == InputAxisType.PXIe ) newAxis = new PXIeInputAxis(); else if( axisType == InputAxisType.AnkleBot ) newAxis = new AnkleBotInputAxis(); else return null; if( !newAxis.Init( axisID ) ) return null; inputAxes.Add( newAxis ); } return newAxis; }
public InputAxis Set(InputAxisType type) { axes.Clear(); Add(type); return(this); }
public InputAxis Add(InputAxisType type) { axes.Add(new InputAxisOfType(type)); return(this); }
public InputAxisOfType(InputAxisType type) { this.type = type; }
public bool ContainsAxis(InputAxisType type) { return(Get(type) != null); }
public void SetAxisType( Int32 typeIndex ) { if( Enum.IsDefined( typeof(InputAxisType), typeIndex ) ) controlAxisType = (InputAxisType) typeIndex; }