using System; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Beyond { public class TriggerDescriptor : IComparable, IComparable { public GameObject obj; public TriggerType type; public TriggerDescriptor(GameObject obj, TriggerType type) { this.obj = obj; this.type = type; } public int CompareTo(TriggerDescriptor other) { return type.CompareTo(other.type); } public int CompareTo(object obj) { if (ReferenceEquals(null, obj)) return 1; return obj is TriggerDescriptor other ? CompareTo(other) : throw new ArgumentException($"Object must be of type {nameof(TriggerDescriptor)}"); } public static bool operator <(TriggerDescriptor left, TriggerDescriptor right) { return left.CompareTo(right) < 0; } public static bool operator >(TriggerDescriptor left, TriggerDescriptor right) { return left.CompareTo(right) > 0; } public static bool operator <=(TriggerDescriptor left, TriggerDescriptor right) { return left.CompareTo(right) <= 0; } public static bool operator >=(TriggerDescriptor left, TriggerDescriptor right) { return left.CompareTo(right) >= 0; } public enum TriggerType { Dialogue, Ladder, Generic, Collectable, COUNT }; } }