Added for AtomReference a check to see if an Atom is actually assigned. (#202)

This commit is contained in:
Oliver Biwer 2020-11-06 22:18:00 +01:00 committed by GitHub
parent 8f6392c373
commit c552881254
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,6 +67,23 @@ namespace UnityAtoms
}
}
/// <summary>
/// <returns>True if the `Usage` is an AtomType and is unassigned. False otherwise.</returns>
/// </summary>
public bool IsUnassigned
{
get
{
switch (_usage)
{
case (AtomReferenceUsage.CONSTANT): return _constant == null;
case (AtomReferenceUsage.VARIABLE): return _variable == null;
case (AtomReferenceUsage.VARIABLE_INSTANCER): return _variableInstancer == null;
}
return false;
}
}
/// <summary>
/// Value used if `Usage` is set to `Value`.
/// </summary>
@ -123,7 +140,7 @@ namespace UnityAtoms
}
/// <summary>
/// Get event by type.
/// Get event by type.
/// </summary>
/// <typeparam name="E"></typeparam>
/// <returns>The event.</returns>