예제 #1
0
파일: SwitchState.cs 프로젝트: AciesNN/FSM
        public StateExit <STATE_ID> AddTestExit(StateTest test)
        {
            int exit = exits.Count;

            exits.Add(new KeyValuePair <StateTest, int>(test, exit));
            return(new StateExit <STATE_ID>(this, exit));
        }
예제 #2
0
파일: SwitchState.cs 프로젝트: AciesNN/FSM
        public override void Enter()
        {
            for (int i = 0; i < exits.Count; ++i)
            {
                StateTest test       = exits[i].Key;
                bool      testResult = test.Test();
                if (testResult)
                {
                    DoExitState(exits[i].Value);
                    return;
                }
            }

            DoExitState(defaultExitId);
        }