Interface ILunyInputService
Engine-agnostic input service providing event-driven and polling access to input actions.
public interface ILunyInputService : ILunyEngineService
Remarks
IMPORTANT: Implementations must inherit from both the ILunyInputService interface and its corresponding LunyInputServiceBase class!
Methods
AssignUserToLastDevice(string, int, ILunyObject)
void AssignUserToLastDevice(string userName, int deviceId, ILunyObject lunyObject)
Parameters
userNamestringdeviceIdintlunyObjectILunyObject
EnableInputAction(string, bool)
void EnableInputAction(string actionName, bool enabled)
Parameters
actionNamestringenabledbool
GetAxis(string)
Gets the analog trigger value (0.0–1.0) for the named button action.
float GetAxis(string actionName)
Parameters
actionNamestring
Returns
- float
GetButtonJustPressed(string)
True only on the frame the button transitioned to pressed.
bool GetButtonJustPressed(string actionName)
Parameters
actionNamestring
Returns
- bool
GetButtonPressed(string)
True while button is held.
bool GetButtonPressed(string actionName)
Parameters
actionNamestring
Returns
- bool
GetButtonStrength(string)
Returns a button's pressed strength. Used by triggers configured to act like buttons.
float GetButtonStrength(string actionName)
Parameters
actionNamestring
Returns
- float
GetDirection(string)
Gets last known axis vector for the named action.
LunyVector2 GetDirection(string actionName)
Parameters
actionNamestring
Returns
GetRotation(string)
Gets last known axis vector as rotation (quaternion). Assumes positive Y is up vector.
LunyQuaternion GetRotation(string actionName)
Parameters
actionNamestring
Returns
GetRotation(string, LunyVector3)
Gets last known axis vector as rotation (quaternion) with custom up vector.
LunyQuaternion GetRotation(string actionName, LunyVector3 worldUp)
Parameters
actionNamestringworldUpLunyVector3
Returns
IsUserPairedWithDevice(string, int)
bool IsUserPairedWithDevice(string userName, int deviceId)
Parameters
userNamestringdeviceIdint
Returns
- bool
SetControlSchemes(params string[])
Activate a given control scheme eg Gamepad or Keyboard&Mouse to prevent other device input from coming through.
void SetControlSchemes(params string[] schemeNames)
Parameters
schemeNamesstring[]
UnassignUser(string)
void UnassignUser(string userName)
Parameters
userNamestring
Events
OnInputAction
Fired when any enabled action changes value.
event Action<LunyInputActionEvent> OnInputAction
Event Type
- Action<LunyInputActionEvent>