using System; using UnityEngine; namespace UnityAtoms.BaseAtoms { public class AtomListReferenceUsage { public const int LIST = 0; public const int LIST_INSTANCER = 1; } /// /// Reference of type `AtomList`. Inherits from `AtomBaseReference`. /// [Serializable] public class AtomListReference : AtomBaseReference, IGetValue { /// /// Get value as an `IAtomList`. Needed in order to inject List References into the Variable Instancer class. /// /// The value as an `IAtomList`. public IAtomList GetValue() => List != null ? List.GetValue() : null; /// /// Get the value for the Reference. /// /// The value of type `AtomList`. public AtomList List { get { switch (_usage) { case (AtomListReferenceUsage.LIST_INSTANCER): return _instancer == null ? default(AtomList) : _instancer.Variable; case (AtomListReferenceUsage.LIST): default: return _list; } } } /// /// Variable used if `Usage` is set to `LIST`. /// [SerializeField] private AtomList _list = default(AtomList); /// /// Variable Instancer used if `Usage` is set to `LIST_INSTANCER`. /// [SerializeField] private AtomListInstancer _instancer = default(AtomListInstancer); } }