Table of Contents

Class LunyInputServiceBase

Namespace
Luny.Engine.Services
Assembly
Luny.dll
public abstract class LunyInputServiceBase : LunyEngineServiceBase, ILunyInputService, ILunyEngineService
Inheritance
object
LunyInputServiceBase
Implements
Derived
Inherited Members

Constructors

LunyInputServiceBase()

protected LunyInputServiceBase()

Properties

LastInputEvent

protected LunyInputActionEvent LastInputEvent { get; }

Property Value

LunyInputActionEvent

Methods

AssignUserToLastDevice(string, int, ILunyObject)

public abstract void AssignUserToLastDevice(string userName, int deviceId, ILunyObject lunyObject)

Parameters

userName string
deviceId int
lunyObject ILunyObject

EnableInputAction(string, bool)

public abstract void EnableInputAction(string actionName, bool enabled)

Parameters

actionName string
enabled bool

GetAxis(string)

Gets the analog trigger value (0.0–1.0) for the named button action.

public float GetAxis(string actionName)

Parameters

actionName string

Returns

float

GetButtonJustPressed(string)

True only on the frame the button transitioned to pressed.

public bool GetButtonJustPressed(string actionName)

Parameters

actionName string

Returns

bool

GetButtonPressed(string)

True while button is held.

public bool GetButtonPressed(string actionName)

Parameters

actionName string

Returns

bool

GetButtonStrength(string)

Returns a button's pressed strength. Used by triggers configured to act like buttons.

public float GetButtonStrength(string actionName)

Parameters

actionName string

Returns

float

GetDirection(string)

Gets last known axis vector for the named action.

public LunyVector2 GetDirection(string actionName)

Parameters

actionName string

Returns

LunyVector2

GetOrCreateInputActionEvent(string)

protected LunyInputActionEvent GetOrCreateInputActionEvent(string actionName)

Parameters

actionName string

Returns

LunyInputActionEvent

GetRotation(string)

Gets last known axis vector as rotation (quaternion). Assumes positive Y is up vector.

public LunyQuaternion GetRotation(string actionName)

Parameters

actionName string

Returns

LunyQuaternion

GetRotation(string, LunyVector3)

Gets last known axis vector as rotation (quaternion) with custom up vector.

public LunyQuaternion GetRotation(string actionName, LunyVector3 worldUp)

Parameters

actionName string
worldUp LunyVector3

Returns

LunyQuaternion

HandleInputActionEvent(LunyInputActionEvent)

protected void HandleInputActionEvent(LunyInputActionEvent inputEvent)

Parameters

inputEvent LunyInputActionEvent

IsUserPairedWithDevice(string, int)

public abstract bool IsUserPairedWithDevice(string userName, int deviceId)

Parameters

userName string
deviceId int

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

actionName string
value float

SetButtonInput(string, bool, float)

protected void SetButtonInput(string actionName, bool pressed, float strength = 1)

Parameters

actionName string
pressed bool
strength float

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

schemeNames string[]

SetDirectionalInput(string, LunyVector2)

protected void SetDirectionalInput(string actionName, LunyVector2 value)

Parameters

actionName string
value LunyVector2

UnassignUser(string)

public abstract void UnassignUser(string userName)

Parameters

userName string

Events

OnInputAction

Fired when any enabled action changes value.

public event Action<LunyInputActionEvent> OnInputAction

Event Type

Action<LunyInputActionEvent>