/// <summary> /// Gets the analog value. /// </summary> /// <returns> for analog input return values -1f to 1f or inverted depending of device</returns> internal float GetAnalogValue(IDevice device, float sensitivity, float dreadzone, float gravity) { //if key,mouse, joy button if (__currentInputAction.getCode(device) < InputCode.MAX_KEY_CODE || InputCode.toAxis(__currentInputAction.getCode(device)) == JoystickAxis.None) { if (InputEx.GetInputHold(__currentInputAction, device) || InputEx.GetInputDown(__currentInputAction, device)) { return(2f * (GetGenericAnalogValue(device, sensitivity, dreadzone, gravity) - 0.5f)); } else { return(0f); } } else { return(InputEx.GetInputAnalog(__currentInputAction, device)); } }
internal bool GetInputDown(IDevice device, bool atOnce = false) { if (__currentInputAction.type == InputActionType.SINGLE && _actionsList.Count == 1) { return(InputEx.GetInputDown(__currentInputAction, device)); } else { if (atOnce) { int len = actions.Length; for (int i = 0; i < len; i++) { //LONG is counted as HOLD in this mode if (actions [i].type == InputActionType.LONG) { if (!InputEx.GetInputHold(actions [i], device)) { return(false); } } else if (!InputEx.GetInputDown(actions [i], device)) { return(false); } } return(true); } else // Double,Long are also count as combinations handled by InputEx.GetAction { return(GetCombinationInput(device)); } } }