MoonWorks/src/Input/VirtualButtons/TriggerButton.cs

26 lines
454 B
C#
Raw Normal View History

2022-07-12 23:09:23 +00:00
namespace MoonWorks.Input
{
public class TriggerButton : VirtualButton
{
public Trigger Parent { get; }
public TriggerCode Code => Parent.Code;
private float threshold = 0.7f;
public float Threshold
{
get => threshold;
set => threshold = System.Math.Clamp(value, 0, 1);
}
internal TriggerButton(Trigger parent)
{
Parent = parent;
}
internal override bool CheckPressed()
{
return Parent.Value >= Threshold;
}
}
}