Transition from one state to another
One state
Let's say you want to go from StateA to StateB if someCondition is valid. For this you need to implement the CheckExitTransition in StateA (since you want to leave this state):
If someCondition is true, then StateB will have to handle the transition. To control the result you'll need to implement the CheckEnterTransition in StateB. By default the CheckEnterTransition will accept the transition (returning true).
Let's say StateB can be entered only from StateA:
Multiple states
Let's say you have two or more states that can be triggered by the same initial condition (someCondition from the previous example). Both uses the same condition, but the target state has some extra conditions as well (CheckEnterTransition). If you need to evaluate multiple states you can enqueue them, one after another.
Last updated