public override void Execute()
 {
     if (mCurrentState != null)
     {
         if (mCurrentState.mStateFlag == ISMStateBase.StateFlag.BeforeEnter)
         {
             mCurrentState.Enter();
         }
         else if (mCurrentState.mStateFlag == ISMStateBase.StateFlag.Executing)
         {
             mCurrentState.Execute();
         }
         else if (mCurrentState.mStateFlag == ISMStateBase.StateFlag.BeforeExit)
         {
             mCurrentState.Exit();
         }
         else if (mCurrentState.mStateFlag == ISMStateBase.StateFlag.AfterExit)
         {
             mCurrentState.ReInit();
             mCurrentState = null;
         }
     }
     else
     {
         if (mStateQueue.Count > 0)
         {
             mCurrentState = mStateQueue.Dequeue();
         }
         else
         {
             EndSelf();
         }
     }
 }
    //this push is a complex operation,coz it will judge whether this state can be enter or if this state  cause other state stop
    protected void PushOne(ISMState <T> state)
    {
        if (!ContainsState(state))
        {
            if (state.mStateFlag == ISMStateBase.StateFlag.BeforeEnter ||
                state.mStateFlag == ISMStateBase.StateFlag.AfterExit)
            {
                //first must be reinit once
                state.ReInit();

                state.Enter();

                if (state.mStateFlag == ISMStateBase.StateFlag.Executing)
                {
                    Add(state);
                }
            }
        }
    }