コード例 #1
0
        public FsmExample()
        {
            //Create the FSM and some Data class to be refrenced in states
            _stateMachine = new Fsm <ConcreteClass, ExampleTransitions>();
            var data = new StateData();

            //Add States
            _stateMachine.AddState(new IdleState(data));
            _stateMachine.AddState(new ActionState(data));

            //AddTransitions
            _stateMachine.AddTransition <IdleState, ActionState>(ExampleTransitions.ReadyToAction);
            _stateMachine.AddTransition <ActionState, IdleState>(ExampleTransitions.Stop);

            //Start the Machine
            _stateMachine.SetInitialState <IdleState>();
            _stateMachine.Start();
        }