A game about forced loneliness, made by TACStudios
1namespace Unity.VisualScripting
2{
3 public struct EventHook
4 {
5 public readonly string name;
6
7 public readonly object target;
8
9 public readonly object tag;
10
11 public EventHook(string name, object target = null, object tag = null)
12 {
13 Ensure.That(nameof(name)).IsNotNull(name);
14
15 this.name = name;
16 this.target = target;
17 this.tag = tag;
18 }
19
20 public override bool Equals(object obj)
21 {
22 if (!(obj is EventHook other))
23 {
24 return false;
25 }
26
27 return Equals(other);
28 }
29
30 public bool Equals(EventHook other)
31 {
32 return name == other.name && Equals(target, other.target) && Equals(tag, other.tag);
33 }
34
35 public override int GetHashCode()
36 {
37 return HashUtility.GetHashCode(name, target, tag);
38 }
39
40 public static bool operator ==(EventHook a, EventHook b)
41 {
42 return a.Equals(b);
43 }
44
45 public static bool operator !=(EventHook a, EventHook b)
46 {
47 return !(a == b);
48 }
49
50 public static implicit operator EventHook(string name)
51 {
52 return new EventHook(name);
53 }
54 }
55}