/// <summary> /// Gets the input normalized. /// </summary> /// <returns>The input normalized.</returns> /// <param name="sensitivity">Sensitivity.</param> /// <param name="dreadzone">Dreadzone.</param> /// <param name="gravity">Gravity.</param> internal float GetInputGenerated(IDevice device, float sensitivity, float dreadzone, float gravity) { if (_actionsList.Count > 1) { return(0); } //if key,mouse if (__currentInputAction.getCode(device) < InputCode.MAX_KEY_CODE) { return(GetGenericAnalogValue(device, sensitivity, dreadzone, gravity)); } else { if (InputEx.GetInputAnalog(__currentInputAction, device) < 0f) { return(-GetGenericAnalogValue(device, sensitivity, dreadzone, gravity)); } return(GetGenericAnalogValue(device, sensitivity, dreadzone, gravity)); } }
/// <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)); } }