public static void Enable(IList <KBind> KeyBinds) { if (KeyBinds.Count > 0 && !AppInput.HasKeyBind(KeyBinds[0])) { for (int i = 0; i < KeyBinds.Count; ++i) { AppInput.AddListener(KeyBinds[i]); } } }
public static void OnEnable(IList <AxBind> AxisBinds) { if (AxisBinds.Count > 0 && !AppInput.HasAxisBind(AxisBinds[0])) { for (int i = 0; i < AxisBinds.Count; ++i) { AppInput.AddListener(AxisBinds[i]); } } }
public static KState GetState(this KCode kCode) { // prevent two-finger-right-click on touch screens, it messes with other right-click behaviour if (kCode == KCode.Mouse1 && UnityEngine.Input.touches != null && UnityEngine.Input.touches.Length >= 2) { return(KState.KeyReleased); } return(AppInput.GetKeyDown(kCode) ? KState.KeyDown : AppInput.GetKeyUp(kCode) ? KState.KeyUp : AppInput.GetKey(kCode) ? KState.KeyHeld : KState.KeyReleased); }
public static void Disable(IList <KBind> KeyBinds) { if (AppInput.IsQuitting) { return; } if (KeyBinds.Count > 0 && AppInput.HasKeyBind(KeyBinds[0])) { for (int i = 0; i < KeyBinds.Count; ++i) { AppInput.RemoveListener(KeyBinds[i]); } } }
public static void OnDisable(IList <AxBind> AxisBinds) { if (AppInput.IsQuitting) { return; } if (AxisBinds.Count > 0 && AppInput.HasAxisBind(AxisBinds[0])) { for (int i = 0; i < AxisBinds.Count; ++i) { AppInput.RemoveListener(AxisBinds[i]); } } }
private void OnEnable() { if (keyBinds.Count > 0 && !AppInput.HasKeyBind(keyBinds[0])) { for (int i = 0; i < keyBinds.Count; ++i) { AppInput.AddListener(keyBinds[i]); } } if (axisBinds.Count > 0 && !AppInput.HasAxisBind(axisBinds[0])) { for (int i = 0; i < axisBinds.Count; ++i) { AppInput.AddListener(axisBinds[i]); } } }
public int AddListener(KBind kBind) { int index = KeyBinds.FindIndex(kb => kb.name == kBind.name); if (index >= 0) { KeyBinds[index] = kBind; } else { index = KeyBinds.Count; KeyBinds.Add(kBind); } if (enabled) { AppInput.AddListener(kBind); } return(index); }
private void OnDisable() { if (AppInput.IsQuitting) { return; } if (keyBinds.Count > 0 && AppInput.HasKeyBind(keyBinds[0])) { for (int i = 0; i < keyBinds.Count; ++i) { AppInput.RemoveListener(keyBinds[i]); } } if (axisBinds.Count > 0 && AppInput.HasAxisBind(axisBinds[0])) { for (int i = 0; i < axisBinds.Count; ++i) { AppInput.RemoveListener(axisBinds[i]); } } }
} // TODO make an easing function over time public float GetValueRaw() { return(AppInput.GetStandardAxis(axis)); }
public float GetValue() { return(AppInput.GetStandardAxis(axis)); } // TODO make an easing function over time
public static bool IsDown(this KCode kCode) { return(AppInput.GetKeyDown(kCode)); }
public static bool IsHeld(this KCode kCode) { return(AppInput.GetKey(kCode)); }
public static bool IsUp(this KCode kCode) { return(AppInput.GetKeyUp(kCode)); }