soundvision/UnityProject/Assets/Scripts/DataModel/Parameter.cs
Chikashi Miyama 78023946cd close #28
2019-09-28 20:17:39 +02:00

37 lines
No EOL
741 B
C#

using System;
namespace cylvester
{
interface IParameter<T> where T : IComparable<T>
{
T Value { set; get; }
event Action ValueChanged;
}
public class Parameter<T> : IParameter<T> where T : IComparable<T>
{
public Parameter(T initial)
{
Value = initial;
}
private T value_;
public T Value
{
get => value_;
set
{
if (value.CompareTo(value_) == 0)
return;
value_ = value;
ValueChanged.Invoke();
}
}
public event Action ValueChanged = () => { };
}
}