UI 자동화를 위해 바인딩 기능 구현
- 유니티 에셋 인증 오류로 meta 재생성
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
namespace UnityEngine.InputSystem.Processors
|
||||
{
|
||||
/// <summary>
|
||||
/// Scale the components of a <see cref="Vector3"/> by constant factors.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This processor is registered (see <see cref="InputSystem.RegisterProcessor{T}"/>) under the name "scaleVector3".
|
||||
///
|
||||
/// <example>
|
||||
/// <code>
|
||||
/// // Double the magnitude of gravity values read from a gravity sensor.
|
||||
/// myAction.AddBinding("<GravitySensor>/gravity").WithProcessor("scaleVector3(x=2,y=2,z=2)");
|
||||
/// </code>
|
||||
/// </example>
|
||||
/// </remarks>
|
||||
/// <seealso cref="ScaleProcessor"/>
|
||||
/// <seealso cref="ScaleVector2Processor"/>
|
||||
public class ScaleVector3Processor : InputProcessor<Vector3>
|
||||
{
|
||||
/// <summary>
|
||||
/// Scale factor to apply to the vector's <c>x</c> axis. Defaults to 1.
|
||||
/// </summary>
|
||||
[Tooltip("Scale factor to multiply the incoming Vector3's X component by.")]
|
||||
public float x = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Scale factor to apply to the vector's <c>y</c> axis. Defaults to 1.
|
||||
/// </summary>
|
||||
[Tooltip("Scale factor to multiply the incoming Vector3's Y component by.")]
|
||||
public float y = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Scale factor to apply to the vector's <c>z</c> axis. Defaults to 1.
|
||||
/// </summary>
|
||||
[Tooltip("Scale factor to multiply the incoming Vector3's Z component by.")]
|
||||
public float z = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Return <paramref name="value"/> scaled by <see cref="x"/>, <see cref="y"/>, and <see cref="z"/>.
|
||||
/// </summary>
|
||||
/// <param name="value">Input value.</param>
|
||||
/// <param name="control">Ignored.</param>
|
||||
/// <returns>Scaled vector.</returns>
|
||||
public override Vector3 Process(Vector3 value, InputControl control)
|
||||
{
|
||||
return new Vector3(value.x * x, value.y * y, value.z * z);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"ScaleVector3(x={x},y={y},z={z})";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user