C# Класс 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.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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.

Описание методов

ContainsBool() публичный Метод

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.
Результат bool

ContainsFloat() публичный Метод

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.
Результат float

Controller() публичный Метод

Initializes a new instance of the Controller class.
public Controller ( PlayerIndex playerIndex ) : System
playerIndex PlayerIndex Index of the player.
Результат System

Rumble() публичный Метод

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).
Результат void

SetPlayerIndex() публичный Метод

Sets the index of the controller for the player on the xbox.
public SetPlayerIndex ( PlayerIndex index ) : void
index PlayerIndex The index of the controller.
Результат void

Update() публичный Метод

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
Результат void