UI 자동화를 위해 바인딩 기능 구현
- 유니티 에셋 인증 오류로 meta 재생성
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
namespace UnityEngine.InputSystem.Processors
|
||||
{
|
||||
/// <summary>
|
||||
/// Inverts the <c>x</c> and/or <c>y</c> channel of a <c>Vector2</c>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This process is registered (see <see cref="InputSystem.RegisterProcessor{T}"/> as "invertVector2" by default.
|
||||
///
|
||||
/// <example>
|
||||
/// <code>
|
||||
/// // 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)");
|
||||
/// </code>
|
||||
/// </example>
|
||||
/// </remarks>
|
||||
/// <seealso cref="InvertVector3Processor"/>
|
||||
public class InvertVector2Processor : InputProcessor<Vector2>
|
||||
{
|
||||
/// <summary>
|
||||
/// If true, the <c>x</c> channel of the <c>Vector2</c> input value is inverted. True by default.
|
||||
/// </summary>
|
||||
public bool invertX = true;
|
||||
|
||||
/// <summary>
|
||||
/// If true, the <c>y</c> channel of the <c>Vector2</c> input value is inverted. True by default.
|
||||
/// </summary>
|
||||
public bool invertY = true;
|
||||
|
||||
/// <summary>
|
||||
/// Invert the <c>x</c> and/or <c>y</c> channel of the given <paramref name="value"/>.
|
||||
/// </summary>
|
||||
/// <param name="value">Input value.</param>
|
||||
/// <param name="control">Ignored.</param>
|
||||
/// <returns>Vector2 with inverted channels.</returns>
|
||||
public override Vector2 Process(Vector2 value, InputControl control)
|
||||
{
|
||||
if (invertX)
|
||||
value.x *= -1;
|
||||
if (invertY)
|
||||
value.y *= -1;
|
||||
return value;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"InvertVector2(invertX={invertX},invertY={invertY})";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user