示例#1
0
        public void SetCurrState(StateType state, DateTime now)
        {
            StateHandler oldHandler = Handlers[(int)_CurrState];

            if (oldHandler != null)
            {
                oldHandler.Leave(now);
            }

            _CurrState = state;
            StateHandler newHandler = Handlers[(int)_CurrState];

            _CurrStateEnterTicks = now.Ticks;
            if (newHandler != null)
            {
                newHandler.Enter(now);
            }
        }