A game about forced loneliness, made by TACStudios
1using System; 2using UnityEngine; 3 4namespace UnityEditor.Graphing 5{ 6 [Serializable] 7 class Edge : IEdge, IComparable<Edge> 8 { 9 [SerializeField] 10 private SlotReference m_OutputSlot; 11 [SerializeField] 12 private SlotReference m_InputSlot; 13 14 public Edge() 15 { } 16 17 public Edge(SlotReference outputSlot, SlotReference inputSlot) 18 { 19 m_OutputSlot = outputSlot; 20 m_InputSlot = inputSlot; 21 } 22 23 public SlotReference outputSlot 24 { 25 get { return m_OutputSlot; } 26 } 27 28 public SlotReference inputSlot 29 { 30 get { return m_InputSlot; } 31 } 32 33 protected bool Equals(Edge other) 34 { 35 return Equals(m_OutputSlot, other.m_OutputSlot) && Equals(m_InputSlot, other.m_InputSlot); 36 } 37 38 public bool Equals(IEdge other) 39 { 40 return Equals(other as object); 41 } 42 43 public override bool Equals(object obj) 44 { 45 if (ReferenceEquals(null, obj)) return false; 46 if (ReferenceEquals(this, obj)) return true; 47 if (obj.GetType() != this.GetType()) return false; 48 return Equals((Edge)obj); 49 } 50 51 public override int GetHashCode() 52 { 53 unchecked 54 { 55 // Can't make fields readonly due to Unity serialization 56 return (m_OutputSlot.GetHashCode() * 397) ^ m_InputSlot.GetHashCode(); 57 } 58 } 59 60 public int CompareTo(Edge other) 61 { 62 if (ReferenceEquals(this, other)) return 0; 63 if (ReferenceEquals(null, other)) return 1; 64 var outputSlotComparison = m_OutputSlot.CompareTo(other.m_OutputSlot); 65 if (outputSlotComparison != 0) return outputSlotComparison; 66 return m_InputSlot.CompareTo(other.m_InputSlot); 67 } 68 } 69}