暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

InvertProcessor.cs 1.1KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using UnityEngine.Scripting;
  2. namespace UnityEngine.InputSystem.Processors
  3. {
  4. /// <summary>
  5. /// An input processor that inverts its input value.
  6. /// </summary>
  7. /// <remarks>
  8. /// This process is registered (see <see cref="InputSystem.RegisterProcessor{T}"/> as "invert" by default.
  9. ///
  10. /// <example>
  11. /// <code>
  12. /// // Bind to the gamepad's left trigger such that it returns inverted values.
  13. /// new InputAction(binding: "&lt;Gamepad&gt;/leftTrigger", processors="invert");
  14. /// </code>
  15. /// </example>
  16. /// </remarks>
  17. public class InvertProcessor : InputProcessor<float>
  18. {
  19. /// <summary>
  20. /// Return the inverted value of <paramref name="value"/>.
  21. /// </summary>
  22. /// <param name="value">Input value.</param>
  23. /// <param name="control">Ignored.</param>
  24. /// <returns>Invert value.</returns>
  25. public override float Process(float value, InputControl control)
  26. {
  27. return value * -1.0f;
  28. }
  29. /// <inheritdoc/>
  30. public override string ToString()
  31. {
  32. return "Invert()";
  33. }
  34. }
  35. }