A game about forced loneliness, made by TACStudios
1using UnityEngine;
2
3namespace Unity.VisualScripting
4{
5 /// <summary>
6 /// Checks if an object variable is defined.
7 /// </summary>
8 [UnitSurtitle("Object")]
9 public sealed class IsObjectVariableDefined : IsVariableDefinedUnit, IObjectVariableUnit
10 {
11 public IsObjectVariableDefined() : base() { }
12
13 public IsObjectVariableDefined(string name) : base(name) { }
14
15 /// <summary>
16 /// The source of the variable.
17 /// </summary>
18 [DoNotSerialize]
19 [PortLabelHidden]
20 [NullMeansSelf]
21 public ValueInput source { get; private set; }
22
23 protected override void Definition()
24 {
25 source = ValueInput<GameObject>(nameof(source), null).NullMeansSelf();
26
27 base.Definition();
28
29 Requirement(source, isDefined);
30 }
31
32 protected override VariableDeclarations GetDeclarations(Flow flow)
33 {
34 return Variables.Object(flow.GetValue<GameObject>(source));
35 }
36 }
37}