Firstborn/Library/PackageCache/com.unity.visualscripting@1.../Runtime/VisualScripting.State/AnyState.cs
Schaken-Mods 9092858a58 updated to the latest editor
I updated everything to the latest Unity Editor. Also realized I had the wrong shaders on my hairs, those are fixed and the hairs look MUCH better!
2023-05-07 17:43:11 -05:00

44 lines
1.2 KiB
C#

namespace Unity.VisualScripting
{
/// <summary>
/// A special state that can trigger transitions to other states,
/// no matter which state is currently active. This state cannot receive
/// transitions.
/// </summary>
public sealed class AnyState : State
{
[DoNotSerialize]
public override bool canBeDestination => false;
public AnyState() : base()
{
isStart = true;
}
public override void OnExit(Flow flow, StateExitReason reason)
{
// Don't exit this state from branching.
if (reason == StateExitReason.Branch)
{
return;
}
base.OnExit(flow, reason);
}
public override void OnBranchTo(Flow flow, IState destination)
{
// Before entering the destination destination state,
// exit all other connected states.
foreach (var outgoingTransition in outgoingTransitionsNoAlloc)
{
if (outgoingTransition.destination != destination)
{
outgoingTransition.destination.OnExit(flow, StateExitReason.AnyBranch);
}
}
}
}
}