using UnityEngine.Scripting; namespace UnityEngine.InputSystem.Processors { /// /// Inverts the x and/or y channel of a Vector2. /// /// /// This process is registered (see as "invertVector2" by default. /// /// /// /// // Bind to the left stick on the gamepad such that its Y channel is inverted. /// new InputAction(binding: "<Gamepad>/leftStick", processors="invertVector2(invertY,invertX=false)"); /// /// /// /// public class InvertVector2Processor : InputProcessor { /// /// If true, the x channel of the Vector2 input value is inverted. True by default. /// public bool invertX = true; /// /// If true, the y channel of the Vector2 input value is inverted. True by default. /// public bool invertY = true; /// /// Invert the x and/or y channel of the given . /// /// Input value. /// Ignored. /// Vector2 with inverted channels. public override Vector2 Process(Vector2 value, InputControl control) { if (invertX) value.x *= -1; if (invertY) value.y *= -1; return value; } /// public override string ToString() { return $"InvertVector2(invertX={invertX},invertY={invertY})"; } } }