using System; using System.Collections.Generic; using UnityEngine; namespace UnityAtoms { public abstract class ScriptableObjectVariableBase : ScriptableObject, IWithValue { [Multiline] public string DeveloperDescription = ""; public virtual T Value { get { return value; } set { throw new NotImplementedException(); } } [SerializeField] protected T value; protected bool Equals(ScriptableObjectVariableBase other) { return EqualityComparer.Default.Equals(value, other.value); } public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; if (obj.GetType() != this.GetType()) return false; return Equals((ScriptableObjectVariableBase) obj); } public override int GetHashCode() { unchecked { return EqualityComparer.Default.GetHashCode(value); } } public static bool operator ==(ScriptableObjectVariableBase left, ScriptableObjectVariableBase right) { return Equals(left, right); } public static bool operator !=(ScriptableObjectVariableBase left, ScriptableObjectVariableBase right) { return !Equals(left, right); } } }