Class VirtualButtonTwoWay
Describes a IVirtualButton using the sum of a negative and positive button.
public class VirtualButtonTwoWay : IVirtualButton
- Inheritance
-
VirtualButtonTwoWay
- Implements
Remarks
This virtual button is for example useful to bind a key to a negative value (key 'left') and another key to a positive value (key 'right') thus simulating an axis button. The result of this virtual
Result = PositiveButton.GetValue - NegativeButton.GetValue;
Constructors
VirtualButtonTwoWay()
Initializes a new instance of the VirtualButtonTwoWay class.
public VirtualButtonTwoWay()
VirtualButtonTwoWay(IVirtualButton, IVirtualButton)
Initializes a new instance of the VirtualButtonTwoWay class.
public VirtualButtonTwoWay(IVirtualButton negativeButton, IVirtualButton positiveButton)
Parameters
negativeButton
IVirtualButtonThe negative button.
positiveButton
IVirtualButtonThe positive button.
Properties
NegativeButton
Gets or sets the negative button that will generate a 'negative' value if it is pressed.
public IVirtualButton NegativeButton { get; set; }
Property Value
- IVirtualButton
The negative button.
PositiveButton
Gets or sets the positive button that will generate a 'positive' value if it is pressed.
public IVirtualButton PositiveButton { get; set; }
Property Value
- IVirtualButton
The positive button.
Methods
GetValue(InputManager)
Gets the value associated with this virtual button from an input manager.
public virtual float GetValue(InputManager manager)
Parameters
manager
InputManagerThe manager.
Returns
- float
System.Single.
IsDown(InputManager)
Indicate if the button is currently down
public bool IsDown(InputManager manager)
Parameters
manager
InputManagerThe input manager
Returns
IsPressed(InputManager)
Indicate if the button has been pressed since the last frame
public bool IsPressed(InputManager manager)
Parameters
manager
InputManagerThe input manager
Returns
IsReleased(InputManager)
Indicate if the button has been released since the last frame
public bool IsReleased(InputManager manager)
Parameters
manager
InputManagerThe 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.