A game about forced loneliness, made by TACStudios
1using System; 2 3namespace Unity.VisualScripting 4{ 5 /// <summary> 6 /// Compares two inputs to determine if they are equal or not equal. 7 /// </summary> 8 [UnitCategory("Logic")] 9 [UnitTitle("Equality Comparison")] 10 [UnitSurtitle("Equality")] 11 [UnitShortTitle("Comparison")] 12 [UnitOrder(4)] 13 [Obsolete("Use the Comparison node instead.")] 14 public sealed class EqualityComparison : Unit 15 { 16 /// <summary> 17 /// The first input. 18 /// </summary> 19 [DoNotSerialize] 20 public ValueInput a { get; private set; } 21 22 /// <summary> 23 /// The second input. 24 /// </summary> 25 [DoNotSerialize] 26 public ValueInput b { get; private set; } 27 28 /// <summary> 29 /// Whether A is equal to B. 30 /// </summary> 31 [DoNotSerialize] 32 [PortLabel("A = B")] 33 public ValueOutput equal { get; private set; } 34 35 /// <summary> 36 /// Whether A is different than B. 37 /// </summary> 38 [DoNotSerialize] 39 [PortLabel("A \u2260 B")] 40 public ValueOutput notEqual { get; private set; } 41 42 protected override void Definition() 43 { 44 a = ValueInput<object>(nameof(a)).AllowsNull(); 45 b = ValueInput<object>(nameof(b)).AllowsNull(); 46 equal = ValueOutput(nameof(equal), Equal).Predictable(); 47 notEqual = ValueOutput(nameof(notEqual), NotEqual).Predictable(); 48 49 Requirement(a, equal); 50 Requirement(b, equal); 51 52 Requirement(a, notEqual); 53 Requirement(b, notEqual); 54 } 55 56 private bool Equal(Flow flow) 57 { 58 return OperatorUtility.Equal(flow.GetValue(a), flow.GetValue(b)); 59 } 60 61 private bool NotEqual(Flow flow) 62 { 63 return OperatorUtility.NotEqual(flow.GetValue(a), flow.GetValue(b)); 64 } 65 } 66}