Class LunyInputServiceBase
public abstract class LunyInputServiceBase : LunyEngineServiceBase, ILunyInputService, ILunyEngineService
- Inheritance
-
objectLunyInputServiceBase
- Implements
- Derived
- Inherited Members
Constructors
LunyInputServiceBase()
protected LunyInputServiceBase()
Properties
LastInputEvent
protected LunyInputActionEvent LastInputEvent { get; }
Property Value
Methods
AssignUserToLastDevice(string, int, ILunyObject)
public abstract void AssignUserToLastDevice(string userName, int deviceId, ILunyObject lunyObject)
Parameters
userNamestringdeviceIdintlunyObjectILunyObject
EnableInputAction(string, bool)
public abstract void EnableInputAction(string actionName, bool enabled)
Parameters
actionNamestringenabledbool
GetAxis(string)
Gets the analog trigger value (0.0–1.0) for the named button action.
public float GetAxis(string actionName)
Parameters
actionNamestring
Returns
- float
GetButtonJustPressed(string)
True only on the frame the button transitioned to pressed.
public bool GetButtonJustPressed(string actionName)
Parameters
actionNamestring
Returns
- bool
GetButtonPressed(string)
True while button is held.
public bool GetButtonPressed(string actionName)
Parameters
actionNamestring
Returns
- bool
GetButtonStrength(string)
Returns a button's pressed strength. Used by triggers configured to act like buttons.
public float GetButtonStrength(string actionName)
Parameters
actionNamestring
Returns
- float
GetDirection(string)
Gets last known axis vector for the named action.
public LunyVector2 GetDirection(string actionName)
Parameters
actionNamestring
Returns
GetOrCreateInputActionEvent(string)
protected LunyInputActionEvent GetOrCreateInputActionEvent(string actionName)
Parameters
actionNamestring
Returns
GetRotation(string)
Gets last known axis vector as rotation (quaternion). Assumes positive Y is up vector.
public LunyQuaternion GetRotation(string actionName)
Parameters
actionNamestring
Returns
GetRotation(string, LunyVector3)
Gets last known axis vector as rotation (quaternion) with custom up vector.
public LunyQuaternion GetRotation(string actionName, LunyVector3 worldUp)
Parameters
actionNamestringworldUpLunyVector3
Returns
HandleInputActionEvent(LunyInputActionEvent)
protected void HandleInputActionEvent(LunyInputActionEvent inputEvent)
Parameters
inputEventLunyInputActionEvent
IsUserPairedWithDevice(string, int)
public abstract bool IsUserPairedWithDevice(string userName, int deviceId)
Parameters
userNamestringdeviceIdint
Returns
- bool
OnServiceFrameUpdate()
protected override void OnServiceFrameUpdate()
OnServicePostUpdate()
Clears per-frame transition flags. Called at the start of each frame via OnServicePreUpdate.
protected override void OnServicePostUpdate()
SetAxisInput(string, float)
protected void SetAxisInput(string actionName, float value)
Parameters
actionNamestringvaluefloat
SetButtonInput(string, bool, float)
protected void SetButtonInput(string actionName, bool pressed, float strength = 1)
Parameters
actionNamestringpressedboolstrengthfloat
SetControlSchemes(params string[])
Activate a given control scheme eg Gamepad or Keyboard&Mouse to prevent other device input from coming through.
public abstract void SetControlSchemes(params string[] schemeNames)
Parameters
schemeNamesstring[]
SetDirectionalInput(string, LunyVector2)
protected void SetDirectionalInput(string actionName, LunyVector2 value)
Parameters
actionNamestringvalueLunyVector2
UnassignUser(string)
public abstract void UnassignUser(string userName)
Parameters
userNamestring
Events
OnInputAction
Fired when any enabled action changes value.
public event Action<LunyInputActionEvent> OnInputAction
Event Type
- Action<LunyInputActionEvent>