using UnityEngine.Scripting;
namespace UnityEngine.InputSystem.Processors
{
///
/// Scale a float value by a constant factor.
///
///
/// This processor is registered (see ) under the name "scale".
///
///
///
///
/// // Bind to left trigger on the gamepad such that its values are scaled by a factor of 2.
/// new InputAction(binding: "<Gamepad>/leftTrigger", processors: "scale(factor=2)");
///
///
///
///
public class ScaleProcessor : InputProcessor
{
///
/// Scale factor to apply to incoming input values. Defaults to 1 (no scaling).
///
[Tooltip("Scale factor to multiply incoming float values by.")]
public float factor = 1;
///
/// Scale the given by .
///
/// Input value.
/// Ignored.
/// Scaled value.
public override float Process(float value, InputControl control)
{
return value * factor;
}
///
public override string ToString()
{
return $"Scale(factor={factor})";
}
}
}