Initial Commit
This commit is contained in:
parent
53eb92e9af
commit
270ab7d11f
15341 changed files with 700234 additions and 0 deletions
|
@ -0,0 +1,69 @@
|
|||
namespace Unity.VisualScripting
|
||||
{
|
||||
[TypeIcon(typeof(StateGraph))]
|
||||
public sealed class SuperState : NesterState<StateGraph, StateGraphAsset>, IGraphEventListener
|
||||
{
|
||||
public SuperState() : base() { }
|
||||
|
||||
public SuperState(StateGraphAsset macro) : base(macro) { }
|
||||
|
||||
public static SuperState WithStart()
|
||||
{
|
||||
var superState = new SuperState();
|
||||
superState.nest.source = GraphSource.Embed;
|
||||
superState.nest.embed = StateGraph.WithStart();
|
||||
return superState;
|
||||
}
|
||||
|
||||
#region Lifecycle
|
||||
|
||||
protected override void OnEnterImplementation(Flow flow)
|
||||
{
|
||||
if (flow.stack.TryEnterParentElement(this))
|
||||
{
|
||||
nest.graph.Start(flow);
|
||||
flow.stack.ExitParentElement();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnExitImplementation(Flow flow)
|
||||
{
|
||||
if (flow.stack.TryEnterParentElement(this))
|
||||
{
|
||||
nest.graph.Stop(flow);
|
||||
flow.stack.ExitParentElement();
|
||||
}
|
||||
}
|
||||
|
||||
public void StartListening(GraphStack stack)
|
||||
{
|
||||
if (stack.TryEnterParentElement(this))
|
||||
{
|
||||
nest.graph.StartListening(stack);
|
||||
stack.ExitParentElement();
|
||||
}
|
||||
}
|
||||
|
||||
public void StopListening(GraphStack stack)
|
||||
{
|
||||
if (stack.TryEnterParentElement(this))
|
||||
{
|
||||
nest.graph.StopListening(stack);
|
||||
stack.ExitParentElement();
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsListening(GraphPointer pointer)
|
||||
{
|
||||
return pointer.GetElementData<Data>(this).isActive;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public override StateGraph DefaultGraph()
|
||||
{
|
||||
return StateGraph.WithStart();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue