Files
MojSadUnity/Assets/UnityCodeGen.Generated/Code.Infrastructure.App.AppStateMachine.Generated.cs
T
2026-02-26 13:19:15 +03:00

40 lines
1.4 KiB
C#

// <auto-generated/>
#pragma warning disable CS0105
using Code.Infrastructure.StateMachine;
using Code.Infrastructure.App.States;
#pragma warning restore CS0105
namespace Code.Infrastructure.App
{
public partial class AppStateMachine : AbstractStateMachine<Code.Infrastructure.App.AppStates,Code.Infrastructure.App.AppStateMachineContext>
{
public AppStateMachine(Code.Infrastructure.App.AppStateMachineContext context, EventBus.EventBus eventBus) : base(context)
{
var stateBootstrapState = new BootstrapState(StateMachineContext,eventBus);
States.Add(stateBootstrapState.myState, stateBootstrapState);
}
protected override bool CheckTransitionAllowed(Code.Infrastructure.App.AppStates nextState) => AllowedStates.HasFlag(nextState);
protected override void ResetAllowedTransitions() => AllowedStates = 0;
}
public static class AppStateMachineExtensions
{
public static AbstractStateMachine<Code.Infrastructure.App.AppStates, Code.Infrastructure.App.AppStateMachineContext> AllowStateTransition(
this AbstractStateMachine<Code.Infrastructure.App.AppStates, Code.Infrastructure.App.AppStateMachineContext> stateMachine, Code.Infrastructure.App.AppStates state)
{
if (stateMachine == null) return null;
stateMachine.AllowedStates |= state;
return stateMachine;
}
}
}