mirror of
https://github.com/unity-atoms/unity-atoms.git
synced 2025-01-23 16:48:23 -05:00
36 lines
748 B
C#
36 lines
748 B
C#
namespace UnityAtoms
|
|
{
|
|
public abstract class AtomReference { }
|
|
|
|
public abstract class AtomReference<T, V> : AtomReference
|
|
where V : AtomBaseVariable<T>
|
|
{
|
|
public bool UseConstant;
|
|
|
|
public T ConstantValue;
|
|
|
|
public V Variable;
|
|
|
|
protected AtomReference()
|
|
{
|
|
UseConstant = true;
|
|
}
|
|
|
|
protected AtomReference(T value) : this()
|
|
{
|
|
UseConstant = true;
|
|
ConstantValue = value;
|
|
}
|
|
|
|
public T Value
|
|
{
|
|
get { return UseConstant ? ConstantValue : Variable.Value; }
|
|
}
|
|
|
|
public static implicit operator T(AtomReference<T, V> reference)
|
|
{
|
|
return reference.Value;
|
|
}
|
|
}
|
|
}
|