mirror of
https://github.com/unity-atoms/unity-atoms.git
synced 2025-01-22 08:08:51 -05:00
Merge pull request #78 from Saso222/canary
Setter to AtomReference's Value was added
This commit is contained in:
commit
e2faf2e3d6
@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityAtoms
|
||||
@ -56,7 +57,7 @@ namespace UnityAtoms
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the value for the Reference.
|
||||
/// Get or set the value for the Reference.
|
||||
/// </summary>
|
||||
/// <value>The value of type `T`.</value>
|
||||
public T Value
|
||||
@ -72,6 +73,25 @@ namespace UnityAtoms
|
||||
return _value;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (_usage)
|
||||
{
|
||||
case (AtomReference.Usage.Variable):
|
||||
{
|
||||
_variable.Value = value;
|
||||
break;
|
||||
}
|
||||
case (AtomReference.Usage.Value):
|
||||
{
|
||||
_value = value;
|
||||
break;
|
||||
}
|
||||
case (AtomReference.Usage.Constant):
|
||||
default:
|
||||
throw new NotSupportedException("Can't reassign constant value");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static implicit operator T(AtomReference<T, V, C> reference)
|
||||
|
Loading…
Reference in New Issue
Block a user