public static bool Is(this InputActivity inputActivity, InputActivity desiredActivity) { switch (desiredActivity) { case InputActivity.Idle: return inputActivity.IsIdle(); case InputActivity.Pressed: return inputActivity.IsPressed(); case InputActivity.Released: return inputActivity.IsReleased(); case InputActivity.Triggered: return inputActivity.IsTriggered(); default: throw new NotSupportedException(); } }
public void Update(ElapsedTime elapsedTime) { if (!Enabled) { return; } foreach (IInput input in InputSystem.Instance.Sources.SelectMany(x => x.InstantiatedInputs)) { if (InputFilter != null && !InputFilter(input)) { continue; } InputActivity inputActivity = input.Activity; if (!inputActivity.IsChanged()) { continue; } string activityName; switch (inputActivity) { case InputActivity.Triggered: activityName = "triggered"; break; case InputActivity.Released: activityName = "released"; break; default: throw new NotSupportedException(); } Logger.Debug($"({input.Source.DisplayName}) {input.DisplayName} is {activityName}"); } }
public static bool Is(this IControl<InputActivity> control, InputActivity desiredActivity) { InputActivity inputActivity; return control.IsActive(out inputActivity) && inputActivity.Is(desiredActivity); }
public Control(string name, IInput input, InputActivity desiredActivity = InputActivity.Triggered) : this(input, desiredActivity) { Name = name; }
public Control(IInput input, InputActivity desiredActivity = InputActivity.Triggered) { Input = input; DesiredActivity = desiredActivity; }