mirror of
https://github.com/unity-atoms/unity-atoms.git
synced 2025-01-24 00:58:59 -05:00
42ef1682c0
- they are not needed and hinder the implementation if a type does not have events
34 lines
747 B
C#
34 lines
747 B
C#
namespace UnityAtoms
|
|
{
|
|
public abstract class ScriptableObjectReference<T, V>
|
|
where V : ScriptableObjectVariableBase<T>
|
|
{
|
|
public bool UseConstant;
|
|
|
|
public T ConstantValue;
|
|
|
|
public V Variable;
|
|
|
|
protected ScriptableObjectReference()
|
|
{
|
|
UseConstant = true;
|
|
}
|
|
|
|
protected ScriptableObjectReference(T value) : this()
|
|
{
|
|
UseConstant = true;
|
|
ConstantValue = value;
|
|
}
|
|
|
|
public T Value
|
|
{
|
|
get { return UseConstant ? ConstantValue : Variable.Value; }
|
|
}
|
|
|
|
public static implicit operator T(ScriptableObjectReference<T, V> reference)
|
|
{
|
|
return reference.Value;
|
|
}
|
|
}
|
|
}
|