A game about forced loneliness, made by TACStudios
1namespace Unity.VisualScripting 2{ 3 [TypeIcon(typeof(StateGraph))] 4 public sealed class SuperState : NesterState<StateGraph, StateGraphAsset>, IGraphEventListener 5 { 6 public SuperState() : base() { } 7 8 public SuperState(StateGraphAsset macro) : base(macro) { } 9 10 public static SuperState WithStart() 11 { 12 var superState = new SuperState(); 13 superState.nest.source = GraphSource.Embed; 14 superState.nest.embed = StateGraph.WithStart(); 15 return superState; 16 } 17 18 #region Lifecycle 19 20 protected override void OnEnterImplementation(Flow flow) 21 { 22 if (flow.stack.TryEnterParentElement(this)) 23 { 24 nest.graph.Start(flow); 25 flow.stack.ExitParentElement(); 26 } 27 } 28 29 protected override void OnExitImplementation(Flow flow) 30 { 31 if (flow.stack.TryEnterParentElement(this)) 32 { 33 nest.graph.Stop(flow); 34 flow.stack.ExitParentElement(); 35 } 36 } 37 38 public void StartListening(GraphStack stack) 39 { 40 if (stack.TryEnterParentElement(this)) 41 { 42 nest.graph.StartListening(stack); 43 stack.ExitParentElement(); 44 } 45 } 46 47 public void StopListening(GraphStack stack) 48 { 49 if (stack.TryEnterParentElement(this)) 50 { 51 nest.graph.StopListening(stack); 52 stack.ExitParentElement(); 53 } 54 } 55 56 public bool IsListening(GraphPointer pointer) 57 { 58 return pointer.GetElementData<Data>(this).isActive; 59 } 60 61 #endregion 62 63 64 public override StateGraph DefaultGraph() 65 { 66 return StateGraph.WithStart(); 67 } 68 } 69}