Generic Haxe3 Finite State Machine