Skip to content

How to transition between child and parent states in HSM? #249

Answered by limbonaut
drvelociraptor asked this question in Q&A
Discussion options

You must be logged in to vote

I assume there’s a reason for this, but can I ask why it works this way?

LimboState is not a composite state, so it cannot contain other states as children (you could use class inheritance instead if you want to share some functionality). Adding more states under vanilla LimboState not going to work. And LimboHSM is a composite that can have exactly one child substate active. We call it active substate. Think of it like a switch - only one of the children states is allowed to be active. And this is what transitions do - switch the active substate on a level. LimboHSM is a state itself (inherits from LimboState), so you can nest them like so:

- LimboHSM1
--- LimboHSM2
----- LimboState1
-…

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@drvelociraptor
Comment options

@limbonaut
Comment options

@limbonaut
Comment options

@limbonaut
Comment options

Answer selected by drvelociraptor
@drvelociraptor
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants