end_of_state
triggered on the end of a state (just before the new state is set)