A game about forced loneliness, made by TACStudios
1using UnityEngine;
2
3namespace Unity.VisualScripting
4{
5 [UnitCategory("Graphs/Graph Nodes")]
6 public abstract class GetGraph<TGraph, TGraphAsset, TMachine> : Unit
7 where TGraph : class, IGraph, new()
8 where TGraphAsset : Macro<TGraph>
9 where TMachine : Machine<TGraph, TGraphAsset>
10 {
11 /// <summary>
12 /// The GameObject to retrieve the graph from.
13 /// </summary>
14 [DoNotSerialize]
15 [PortLabelHidden]
16 [NullMeansSelf]
17 public ValueInput gameObject { get; protected set; }
18
19 /// <summary>
20 /// The graph that is set on the GameObject.
21 /// </summary>
22 [DoNotSerialize]
23 [PortLabel("Graph")]
24 [PortLabelHidden]
25 public ValueOutput graphOutput { get; protected set; }
26
27 protected override void Definition()
28 {
29 gameObject = ValueInput<GameObject>(nameof(gameObject), null).NullMeansSelf();
30 graphOutput = ValueOutput(nameof(graphOutput), Get);
31 }
32
33 TGraphAsset Get(Flow flow)
34 {
35 var go = flow.GetValue<GameObject>(gameObject);
36 return go.GetComponent<TMachine>().nest.macro;
37 }
38 }
39}