using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.Serialization; namespace UnityAtoms { /// /// None generic base class for Variables. Inherits from `BaseAtom`. /// [EditorIcon("atom-icon-teal")] public abstract class AtomBaseVariable : BaseAtom { /// /// The Variable value as an `object`.abstract Beware of boxing! 🥊 /// /// The Variable value as an `object`. public abstract object BaseValue { get; set; } /// /// Abstract method that could be implemented to reset the Variable value. /// public abstract void Reset(bool shouldTriggerEvents = false); } /// /// Generic base class for Variables. Inherits from `AtomBaseVariable`. /// /// The Variable value type. [EditorIcon("atom-icon-teal")] public abstract class AtomBaseVariable : AtomBaseVariable, IEquatable> { /// /// The Variable value as an `object`.abstract Beware of boxing! 🥊 /// /// The Variable value as an `object`. public override object BaseValue { get { return _value; } set { Value = (T)value; } } /// /// The Variable value as a property. /// /// Get or set the Variable value. public virtual T Value { get { return _value; } set { throw new NotImplementedException(); } } [SerializeField] protected T _value = default(T); /// /// Determines equality between Variables. /// /// The other Variable to compare. /// `true` if they are equal, otherwise `false`. public bool Equals(AtomBaseVariable other) { return other == this; } /// /// Not implemented.abstract Throws Exception /// public override void Reset(bool shouldTriggerEvents = false) { throw new NotImplementedException(); } } }