Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconfigure a state #577

Open
Ninho67 opened this issue May 22, 2024 · 0 comments
Open

Reconfigure a state #577

Ninho67 opened this issue May 22, 2024 · 0 comments

Comments

@Ninho67
Copy link

Ninho67 commented May 22, 2024

Hi guys and thanks for the good work.

I have a particular case that I am not capable of solving and need your help. I have several state machines defined with Stateless and some of them have inheritance:

  • StateMachineA
  • StateMachineB
  • StateMachineC

Each class has a ConfigureStateMachine() method where I do all the wiring of triggers for each state. Now if I have the following inheritance schema:

A <|- B <|- C

where some triggers defined for B are not valid for C (but the state machines are identical at 95%).

To illustrate:

// StateMachineA
// ...

protected virtual void ConfigureStateMachine()
{
    // Idle
    IdleStateConfiguration = StateMachine.Configure(MachineExecutionState.Idle);
    IdleStateConfiguration.Permit(StateTrigger.Collision, MachineExecutionState.Suspended);

    // ...
}
// StateMachineB
// ...

protected override void ConfigureStateMachine()
{
    // Idle
    // Here I'm only extending the base state machine, OK
    IdleStateConfiguration.Ignore(StateTrigger.Start);

    // ...
}
// StateMachineC
// ...

protected override void ConfigureStateMachine()
{
    // Idle
    // This won't work because because I have conflicting exit transitions
    IdleStateConfiguration
         .Permit(StateTrigger.Start, MachineExecutionState.Suspended);

    // ...
}

I would like to reset all the wirings of a state so that I can redefine it down the inheritance tree.
The only solution I have so far is to drop the inheritance, duplicate B and do the 5% changes that I need to have C. It is no big deal for small state machines but mine is really big.

Any chance we can get this feature in next release ?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant