C# Class Project290.Inputs.Controller

Used to interact with the gamepad controller. This method reports a list of Actions that the player performed based on what buttons were pressed. These actions may or may not have anything to do with the game world; they only have to do with the controller and the timing and sequence of the presses.
Datei anzeigen Open project: scastle/Solitude Class Usage Examples

Public Methods

Method Description
ContainsBool ( ActionType actionType ) : bool

Determines whether [contains] [the specified action type]. If so, returns true. If not, returns false.

ContainsFloat ( ActionType actionType ) : float

Determines whether [contains] [the specified action type]. If so, returns the ActionQuantity associated with it. If not, returns 0.

Controller ( PlayerIndex playerIndex ) : System

Initializes a new instance of the Controller class.

Rumble ( float leftMotorAmount, float rightMotorAmount, long durationInTicks ) : void

Rumbles the controller.

SetPlayerIndex ( PlayerIndex index ) : void

Sets the index of the controller for the player on the xbox.

Update ( ) : void

Updates the Contoller method, saving the conroller state and incrementing time. It is important that this is only called once per game Update, and this should be called first.

Private Methods

Method Description
CheckAndSetActive ( ) : void

Checks all controller that are plugged in and and if that controller is pressing a button, it sets it as the active controller.

GetActions ( ) : void

Returns a list of actions that the player has performed based on the controller input at the instance that this method is called.

Method Details

ContainsBool() public method

Determines whether [contains] [the specified action type]. If so, returns true. If not, returns false.
public ContainsBool ( ActionType actionType ) : bool
actionType ActionType Type of the action.
return bool

ContainsFloat() public method

Determines whether [contains] [the specified action type]. If so, returns the ActionQuantity associated with it. If not, returns 0.
public ContainsFloat ( ActionType actionType ) : float
actionType ActionType Type of the action.
return float

Controller() public method

Initializes a new instance of the Controller class.
public Controller ( PlayerIndex playerIndex ) : System
playerIndex PlayerIndex Index of the player.
return System

Rumble() public method

Rumbles the controller.
public Rumble ( float leftMotorAmount, float rightMotorAmount, long durationInTicks ) : void
leftMotorAmount float The left motor amount, in [0, 1].
rightMotorAmount float The right motor amount, in [0, 1].
durationInTicks long The duration in ticks (10,000,000 ticks/second).
return void

SetPlayerIndex() public method

Sets the index of the controller for the player on the xbox.
public SetPlayerIndex ( PlayerIndex index ) : void
index PlayerIndex The index of the controller.
return void

Update() public method

Updates the Contoller method, saving the conroller state and incrementing time. It is important that this is only called once per game Update, and this should be called first.
public Update ( ) : void
return void