-
Notifications
You must be signed in to change notification settings - Fork 3
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
Consider providing some example code #3
Comments
Ah, I thought I had the keyboard state machine in the tests section of code. That's not a bad example (though we'd have to restart the timer on every enter) and could be expanded with say a pedestrian wanting to cross. |
Hi, I am also trying to implement a hierarchical state machine and I thought this repo looked promising. It would be nice to declare as per the example above, but that doesn't seem to be possible. There are no docs or examples, its 2 years old so would you suggest I look elsewhere, or is this still a viable option? So here is my effort so far, but i cannot see a way to add a state to a machine, or machines to a state?
|
@macasas maybe this can help for now (documentation can always be improved): final root = hsm.root;
final red = root.newChild(TrafficLightState.red);
final yellow = root.newChild(TrafficLightState.yellow);
final green = root.newChild(TrafficLightState.green); as a bonus; its easier to add event handlers without allocating: red.addHandler(
target: amber,
action: (event, data) {
print('readyTogo action, light is amber');
},
); I use this library for personal projects, so it's not dead, it's just "stable". |
Thanks, I'm having a play :-) |
This library looks really interesting but it isn't immediately clear how to use it correctly. Perhaps by adding a couple of simple examples that highlight some of the usage patterns it could help make it more approachable.
I was thinking something along the lines of the following (but obviously using the correct API)
The text was updated successfully, but these errors were encountered: