Hydrogen Framework  1.3.1
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
Hydrogen.Peripherals.InputMouseButtonControl Class Reference
+ Inheritance diagram for Hydrogen.Peripherals.InputMouseButtonControl:

Public Member Functions

 InputMouseButtonControl (string name, int button, InputAction action)
 
override void Capture ()
 

Additional Inherited Members

- Public Types inherited from Hydrogen.Peripherals.InputControlBase
enum  ControlType { ControlType.KeyboardButton, ControlType.MouseButton, ControlType.Axis, ControlType.DeltaAxis }
 
- Static Public Member Functions inherited from Hydrogen.Peripherals.InputControlBase
static InputControlBase CreateControl (String name, InputAction action)
 
- Static Public Attributes inherited from Hydrogen.Peripherals.InputControlBase
static readonly Dictionary
< String, String > 
DeltaAxes
 
static readonly Dictionary
< String, String > 
Axes
 
static readonly Dictionary
< String, int > 
MouseButtons
 
static readonly Dictionary
< String, KeyCode > 
KeyboardButtons
 
- Protected Member Functions inherited from Hydrogen.Peripherals.InputControlBase
 InputControlBase (String name, InputAction action)
 
- Properties inherited from Hydrogen.Peripherals.InputControlBase
string Name [get, set]
 
string ActionName [get, set]
 
InputAction Action [get, set]
 

Detailed Description

Definition at line 34 of file InputMouseButtonControl.cs.

Constructor & Destructor Documentation

Hydrogen.Peripherals.InputMouseButtonControl.InputMouseButtonControl ( string  name,
int  button,
InputAction  action 
)

Definition at line 40 of file InputMouseButtonControl.cs.

41  : base (name, action)
42  {
43  _button = button;
44  }

Member Function Documentation

override void Hydrogen.Peripherals.InputMouseButtonControl.Capture ( )
virtual

Implements Hydrogen.Peripherals.InputControlBase.

Definition at line 46 of file InputMouseButtonControl.cs.

47  {
48  _last = _now;
49  _now = UnityEngine.Input.GetMouseButton (_button);
50 
51  if (_now && !_last) {
52  _timeBegan = Time.time;
53  Action (InputEvent.Pressed, 1.0f, 0.0f);
54  } else if (!_now && _last) {
55  Action (InputEvent.Released, 0.0f, Time.time - _timeBegan);
56  } else if (_now && _last) {
57  Action (InputEvent.Down, 1.0f, Time.time - _timeBegan);
58  }
59  }