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.
Afficher le fichier Open project: scastle/Solitude Class Usage Examples

Méthodes publiques

Méthode 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

Méthode 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 méthode

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.
Résultat bool

ContainsFloat() public méthode

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.
Résultat float

Controller() public méthode

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

Rumble() public méthode

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).
Résultat void

SetPlayerIndex() public méthode

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

Update() public méthode

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
Résultat void