A game about forced loneliness, made by TACStudios
1namespace Unity.VisualScripting
2{
3 /// <summary>
4 /// Inverts the value of a boolean.
5 /// </summary>
6 [UnitCategory("Logic")]
7 [UnitOrder(3)]
8 public sealed class Negate : Unit
9 {
10 /// <summary>
11 /// The input boolean.
12 /// </summary>
13 [DoNotSerialize]
14 [PortLabel("X")]
15 public ValueInput input { get; private set; }
16
17 /// <summary>
18 /// True if the input is false, false if the input is true.
19 /// </summary>
20 [DoNotSerialize]
21 [PortLabel("~X")]
22 public ValueOutput output { get; private set; }
23
24 protected override void Definition()
25 {
26 input = ValueInput<bool>(nameof(input));
27 output = ValueOutput(nameof(output), Operation).Predictable();
28
29 Requirement(input, output);
30 }
31
32 public bool Operation(Flow flow)
33 {
34 return !flow.GetValue<bool>(input);
35 }
36 }
37}