using R3; using UnityEngine; namespace KitsuneCafe.SOAP { /// /// Base class for ScriptableObject assets that represent a constant, immutable value. /// Implements IReactiveSource by emitting its value once and completing. /// /// The type of the constant value. public abstract class ConstantValue : ScriptableObject, IReactiveSource { #if UNITY_EDITOR [Multiline] public string Description = ""; #endif [SerializeField] protected T value; /// /// Gets the immutable constant value. /// public T Value => value; /// /// Provides an Observable that emits the constant value once and then completes. /// public Observable AsObservable() { return Observable.Return(value); } public override string ToString() { return $"Constant<{typeof(T).Name}>({value?.ToString() ?? "null"})"; } } }