Init
This commit is contained in:
1 parent
a73338916a
commit
fbc1cc8d3e
207 files changed
+10327
-2
No files matched your search
@@ -0,0 +1,54 @@
|
||||
|
||||
// <auto-generated/>
|
||||
#pragma warning disable CS0105
|
||||
using Code.Infrastructure.StateMachine;
|
||||
|
||||
using Code.Infrastructure.App.States;
|
||||
|
||||
using Code.Infrastructure.App.States;
|
||||
|
||||
using Code.Example.Platformer;
|
||||
|
||||
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 stateGameplayState = new GameplayState(StateMachineContext,eventBus);
|
||||
States.Add(stateGameplayState.myState, stateGameplayState);
|
||||
|
||||
var stateBootstrapState = new BootstrapState(StateMachineContext,eventBus);
|
||||
States.Add(stateBootstrapState.myState, stateBootstrapState);
|
||||
|
||||
var statePlatformerState = new PlatformerState(StateMachineContext,eventBus);
|
||||
States.Add(statePlatformerState.myState, statePlatformerState);
|
||||
|
||||
var stateMainMenuState = new MainMenuState(StateMachineContext,eventBus);
|
||||
States.Add(stateMainMenuState.myState, stateMainMenuState);
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user