unity-atoms/Source/Base/ScriptableObjectReference.cs
Soraphis 42ef1682c0 Removed event generic parameters from ScriptableObjectReference
- they are not needed and hinder the implementation if a type does not have events
2019-05-04 11:49:35 +02:00

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;
}
}
}