33 lines
820 B
C#
33 lines
820 B
C#
using KitsuneCafe.Sys;
|
|
using KitsuneCafe.Sys.Attributes;
|
|
using UnityEngine;
|
|
|
|
namespace KitsuneCafe.SOAP
|
|
{
|
|
[CreateAssetMenu(fileName = "FloatValue", menuName = KitsuneCafeMenu.SoapValue + "Float")]
|
|
public class FloatValue : ReactiveValue<float>
|
|
{
|
|
[SerializeField]
|
|
private bool clamp = false;
|
|
public bool Clamped => clamp;
|
|
|
|
[SerializeField, ShowIf("clamp")]
|
|
private Vector2 minMax = Vector2.zero;
|
|
|
|
public override float Value
|
|
{
|
|
get => base.Value;
|
|
set
|
|
{
|
|
if (clamp)
|
|
{
|
|
base.Value = Mathf.Clamp(value, minMax.x, minMax.y);
|
|
}
|
|
else
|
|
{
|
|
base.Value = value;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|