29 lines
599 B
C#
29 lines
599 B
C#
using MessagePack;
|
|
using R3;
|
|
using UnityEngine;
|
|
|
|
namespace KitsuneCafe.SOAP
|
|
{
|
|
public abstract class ConstantValue<T> : ScriptableObject, IReactiveSource<T>
|
|
{
|
|
#if UNITY_EDITOR
|
|
[Multiline]
|
|
public string Description = "";
|
|
#endif
|
|
|
|
[SerializeField]
|
|
protected T value;
|
|
|
|
public T Value => value;
|
|
|
|
public Observable<T> AsObservable()
|
|
{
|
|
return Observable.Return(value);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"Constant<{typeof(T).Name}>({value?.ToString() ?? "null"})";
|
|
}
|
|
}
|
|
}
|