Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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);
        }