Haxe hierarchical state machine