Class VirtualButton
Describes a virtual button (a key from a keyboard, a mouse button, an axis of a joystick...etc.).
public abstract class VirtualButton : IVirtualButton- Inheritance
- 
      objectVirtualButton
- Implements
- Derived
Constructors
VirtualButton(string, VirtualButtonType, int, bool)
Initializes a new instance of the VirtualButton class.
protected VirtualButton(string shortName, VirtualButtonType type, int id, bool isPositiveAndNegative = false)Parameters
- shortNamestring
- The name. 
- typeVirtualButtonType
- The type. 
- idint
- The id. 
- isPositiveAndNegativebool
- if set to - true[is positive and negative].
Fields
Id
Unique Id for a particular button Type.
public readonly int IdField Value
Index
protected readonly int IndexField Value
IsPositiveAndNegative
A boolean indicating whether this button supports positive and negative value.
public readonly bool IsPositiveAndNegativeField Value
ShortName
The short name of this button.
public readonly string ShortNameField Value
Type
Type of this button.
public readonly VirtualButtonType TypeField Value
Properties
Name
The full name of this button.
public string Name { get; }Property Value
Registered
Gets all registered VirtualButton.
public static IReadOnlyCollection<VirtualButton> Registered { get; }Property Value
- IReadOnlyCollection<VirtualButton>
- The registered virtual buttons. 
Methods
BuildButtonName()
protected virtual string BuildButtonName()Returns
Find(int)
Finds a virtual button by the specified id.
public static VirtualButton Find(int id)Parameters
- idint
- The id. 
Returns
- VirtualButton
- An instance of VirtualButton or null if no match. 
Find(string)
Finds a virtual button by the specified name.
public static VirtualButton Find(string name)Parameters
- namestring
- The name. 
Returns
- VirtualButton
- An instance of VirtualButton or null if no match. 
GetValue(InputManager)
Gets the value associated with this virtual button from an input manager.
public abstract float GetValue(InputManager manager)Parameters
- managerInputManager
- The manager. 
Returns
- float
- System.Single. 
IsDown(InputManager)
Indicate if the button is currently down
public abstract bool IsDown(InputManager manager)Parameters
- managerInputManager
- The input manager 
Returns
IsPressed(InputManager)
Indicate if the button has been pressed since the last frame
public abstract bool IsPressed(InputManager manager)Parameters
- managerInputManager
- The input manager 
Returns
IsReleased(InputManager)
Indicate if the button has been released since the last frame
public abstract bool IsReleased(InputManager manager)Parameters
- managerInputManager
- The input manager 
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()Returns
- string
- A string that represents the current object. 
Operators
operator +(IVirtualButton, VirtualButton)
Implements the + operator to combine to VirtualButton.
public static IVirtualButton operator +(IVirtualButton left, VirtualButton right)Parameters
- leftIVirtualButton
- The left virtual button. 
- rightVirtualButton
- The right virtual button. 
Returns
- IVirtualButton
- A set containting the two virtual buttons.