Class VirtualButtonGroup
A combination IVirtualButton, by default evaluated as the operator '&&' to produce a value if all buttons are pressed.
public class VirtualButtonGroup : Collection<IVirtualButton>, IList<IVirtualButton>, ICollection<IVirtualButton>, IReadOnlyList<IVirtualButton>, IReadOnlyCollection<IVirtualButton>, IEnumerable<IVirtualButton>, IList, ICollection, IEnumerable, IVirtualButton
- Inheritance
-
VirtualButtonGroup
- Implements
- Inherited Members
- Extension Methods
Constructors
VirtualButtonGroup(bool)
public VirtualButtonGroup(bool isDisjunction = false)
Parameters
isDisjunction
bool
Properties
IsDisjunction
Gets or sets a value indicating whether this instance is determining the value as a disjunction ('||' operator between buttons), false by default ('&&' operator).
public bool IsDisjunction { get; set; }
Property Value
- bool
true
if this instance is disjunction; otherwise,false
.
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.
InsertItem(int, IVirtualButton)
Inserts an element into the Collection<T> at the specified index.
protected override void InsertItem(int index, IVirtualButton item)
Parameters
index
intThe zero-based index at which
item
should be inserted.item
IVirtualButtonThe object to insert. The value can be null for reference types.
Exceptions
- ArgumentOutOfRangeException
index
is less than zero.-or-
index
is greater than Count.
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
SetItem(int, IVirtualButton)
Replaces the element at the specified index.
protected override void SetItem(int index, IVirtualButton item)
Parameters
index
intThe zero-based index of the element to replace.
item
IVirtualButtonThe new value for the element at the specified index. The value can be null for reference types.
Exceptions
- ArgumentOutOfRangeException
index
is less than zero.-or-
index
is greater than Count.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Operators
operator +(VirtualButtonGroup, IVirtualButton)
Implements the + operator.
public static VirtualButtonGroup operator +(VirtualButtonGroup combination, IVirtualButton virtualButton)
Parameters
combination
VirtualButtonGroupThe combination.
virtualButton
IVirtualButtonThe virtual button.
Returns
- VirtualButtonGroup
The result of the operator.