C# Class XboxCtrlrInput.XCI

Mostra file Open project: JISyed/Unity-XboxCtrlrInput Class Usage Examples

Public Methods

Method Description
DEBUG_LogControllerNames ( ) : void

DEBUG function. Log all controller names to Unity's console.

GetAxis ( XboxAxis axis ) : float

Returns the analog number of the specified axis from any controller.

GetAxis ( XboxAxis axis, XboxController controller ) : float

Returns the float number of the specified axis from a specified controller.

GetAxisRaw ( XboxAxis axis ) : float

Returns the float number of the specified axis from any controller without Unity's smoothing filter.

GetAxisRaw ( XboxAxis axis, XboxController controller ) : float

Returns the float number of the specified axis from a specified controller without Unity's smoothing filter.

GetButton ( XboxButton button ) : bool

Returns true if the specified button is held down by any controller.

GetButton ( XboxButton button, XboxController controller ) : bool

Returns true if the specified button is held down by a specified controller.

GetButtonDown ( XboxButton button ) : bool

Returns true at the frame the specified button starts to press down (not held down) by any controller.

GetButtonDown ( XboxButton button, XboxController controller ) : bool

Returns true at the frame the specified button starts to press down (not held down) by a specified controller.

GetButtonUp ( XboxButton button ) : bool

Returns true at the frame the specified button is released by any controller.

GetButtonUp ( XboxButton button, XboxController controller ) : bool

Returns true at the frame the specified button is released by a specified controller.

GetDPad ( XboxDPad padDirection ) : bool

Returns true if the specified D-Pad direction is pressed down by any controller.

GetDPad ( XboxDPad padDirection, XboxController controller ) : bool

Returns true if the specified D-Pad direction is pressed down by a specified controller.

GetDPadDown ( XboxDPad padDirection ) : bool

Returns true at the frame the specified button is Pressed. Does NOT work on Linux with Wired Controllers.

GetDPadDown ( XboxDPad padDirection, XboxController controller ) : bool

Returns true at the frame the specified button is Pressed by a specified controller. Does NOT work on Linux with Wired Controllers.

GetDPadUp ( XboxDPad padDirection ) : bool

Returns true at the frame the specified button is released. Does NOT work on Linux with Wired Controllers.

GetDPadUp ( XboxDPad padDirection, XboxController controller ) : bool

Returns true at the frame the specified button is released by a specified controller. Does NOT work on Linux with Wired Controllers.

GetNumPluggedCtrlrs ( ) : int

Returns the number of Xbox controllers plugged to the computer.

IsPluggedIn ( int controllerNumber ) : bool

Determines if the controller is plugged in the specified controllerNumber. CAUTION: Only works on Windows Native (Desktop and Editor, not Web)!

Private Methods

Method Description
AdjustAxisValues ( float axisValue, XboxAxis axis, int ctrlrNum ) : float
DetermineAxisCode ( XboxAxis axs, int ctrlrNum ) : string
DetermineButtonCode ( XboxButton btn, int ctrlrNum ) : string
DetermineDPad ( XboxDPad padDir, int ctrlrNum ) : string
DetermineDPadMac ( XboxDPad padDir, int ctrlrNum ) : string
DetermineDPadWirelessLinux ( XboxDPad padDir, int ctrlrNum ) : string
IsControllerNumberValid ( int ctrlrNum ) : bool
IsControllerWireless ( ) : bool
IsControllerWireless ( int ctrlNum ) : bool
OnLinux ( ) : bool
OnMac ( ) : bool
OnWindows ( ) : bool
OnWindowsNative ( ) : bool
RefactorRange ( float oldRangeValue, int ctrlrNum, XboxAxis axis ) : float
XInputApplyDeadzone ( float rawAxisValue, XboxAxis axis, XboxController controller ) : float
XInputGetAxisState ( GamePadThumbSticks xiThumbSticks, XboxAxis xciAxis ) : float
XInputGetAxisState ( GamePadTriggers xiTriggers, XboxAxis xciAxis ) : float
XInputGetButtonState ( GamePadButtons xiButtons, XboxButton xciBtn ) : ButtonState
XInputGetDPadState ( GamePadDPad xiDPad, XboxDPad xciDPad ) : ButtonState
XInputGetPaticularState ( int ctrlNum ) : GamePadState
XInputGetPaticularStatePrev ( int ctrlNum ) : GamePadState
XInputGetSingleState ( ) : GamePadState
XInputGetSingleStatePrev ( ) : GamePadState
XInputStillInCurrFrame ( ) : bool
XInputUpdateAllStates ( ) : void

Method Details

DEBUG_LogControllerNames() public static method

DEBUG function. Log all controller names to Unity's console.
public static DEBUG_LogControllerNames ( ) : void
return void

GetAxis() public static method

Returns the analog number of the specified axis from any controller.
public static GetAxis ( XboxAxis axis ) : float
axis XboxAxis /// An identifier for the specified Xbox axis to be tested. ///
return float

GetAxis() public static method

Returns the float number of the specified axis from a specified controller.
public static GetAxis ( XboxAxis axis, XboxController controller ) : float
axis XboxAxis /// An identifier for the specified Xbox axis to be tested. ///
controller XboxController /// An identifier for the specific controller on which to test the axis. ///
return float

GetAxisRaw() public static method

Returns the float number of the specified axis from any controller without Unity's smoothing filter.
public static GetAxisRaw ( XboxAxis axis ) : float
axis XboxAxis /// An identifier for the specified Xbox axis to be tested. ///
return float

GetAxisRaw() public static method

Returns the float number of the specified axis from a specified controller without Unity's smoothing filter.
public static GetAxisRaw ( XboxAxis axis, XboxController controller ) : float
axis XboxAxis /// An identifier for the specified Xbox axis to be tested. ///
controller XboxController /// An identifier for the specific controller on which to test the axis. ///
return float

GetButton() public static method

Returns true if the specified button is held down by any controller.
public static GetButton ( XboxButton button ) : bool
button XboxButton /// Identifier for the Xbox button to be tested. ///
return bool

GetButton() public static method

Returns true if the specified button is held down by a specified controller.
public static GetButton ( XboxButton button, XboxController controller ) : bool
button XboxButton /// Identifier for the Xbox button to be tested. ///
controller XboxController /// An identifier for the specific controller on which to test the button. ///
return bool

GetButtonDown() public static method

Returns true at the frame the specified button starts to press down (not held down) by any controller.
public static GetButtonDown ( XboxButton button ) : bool
button XboxButton /// Identifier for the Xbox button to be tested. ///
return bool

GetButtonDown() public static method

Returns true at the frame the specified button starts to press down (not held down) by a specified controller.
public static GetButtonDown ( XboxButton button, XboxController controller ) : bool
button XboxButton /// Identifier for the Xbox button to be tested. ///
controller XboxController /// An identifier for the specific controller on which to test the button. ///
return bool

GetButtonUp() public static method

Returns true at the frame the specified button is released by any controller.
public static GetButtonUp ( XboxButton button ) : bool
button XboxButton /// Identifier for the Xbox button to be tested. ///
return bool

GetButtonUp() public static method

Returns true at the frame the specified button is released by a specified controller.
public static GetButtonUp ( XboxButton button, XboxController controller ) : bool
button XboxButton /// Identifier for the Xbox button to be tested. ///
controller XboxController /// An identifier for the specific controller on which to test the button. ///
return bool

GetDPad() public static method

Returns true if the specified D-Pad direction is pressed down by any controller.
public static GetDPad ( XboxDPad padDirection ) : bool
padDirection XboxDPad /// An identifier for the specified D-Pad direction to be tested. ///
return bool

GetDPad() public static method

Returns true if the specified D-Pad direction is pressed down by a specified controller.
public static GetDPad ( XboxDPad padDirection, XboxController controller ) : bool
padDirection XboxDPad /// An identifier for the specified D-Pad direction to be tested. ///
controller XboxController /// An identifier for the specific controller on which to test the D-Pad. ///
return bool

GetDPadDown() public static method

Returns true at the frame the specified button is Pressed. Does NOT work on Linux with Wired Controllers.
public static GetDPadDown ( XboxDPad padDirection ) : bool
padDirection XboxDPad
return bool

GetDPadDown() public static method

Returns true at the frame the specified button is Pressed by a specified controller. Does NOT work on Linux with Wired Controllers.
public static GetDPadDown ( XboxDPad padDirection, XboxController controller ) : bool
padDirection XboxDPad
controller XboxController /// An identifier for the specific controller on which to test the button. ///
return bool

GetDPadUp() public static method

Returns true at the frame the specified button is released. Does NOT work on Linux with Wired Controllers.
public static GetDPadUp ( XboxDPad padDirection ) : bool
padDirection XboxDPad
return bool

GetDPadUp() public static method

Returns true at the frame the specified button is released by a specified controller. Does NOT work on Linux with Wired Controllers.
public static GetDPadUp ( XboxDPad padDirection, XboxController controller ) : bool
padDirection XboxDPad
controller XboxController /// An identifier for the specific controller on which to test the button. ///
return bool

GetNumPluggedCtrlrs() public static method

Returns the number of Xbox controllers plugged to the computer.
public static GetNumPluggedCtrlrs ( ) : int
return int

IsPluggedIn() public static method

Determines if the controller is plugged in the specified controllerNumber. CAUTION: Only works on Windows Native (Desktop and Editor, not Web)!
public static IsPluggedIn ( int controllerNumber ) : bool
controllerNumber int /// An identifier for the specific controller on which to test the axis. An int between 1 and 4. ///
return bool