예제 #1
0
 /// <summary>
 /// 还原事件
 /// </summary>
 public void RestoreState()
 {
     if (stateList[nowStep].ExitAction != null)   //如果当前状态的退出函数不为空
     {
         stateList[nowStep].ExitAction.Invoke();  //执行退出函数
     }
     if (TmpReductionStateEvent != null)          //如果临时还原函数不为空
     {
         TmpReductionStateEvent.Invoke(NowValue); //执行临时还原函数
         TmpReductionStateEvent = null;           //将临时还原函数置空
     }
     if (ReductionStateEvent != null)             //如果公共还原函数不为空
     {
         ReductionStateEvent.Invoke(NowValue);    //执行公共还原函数
     }
     nowStep += 1;
     if (nowStep >= stateList.Count)           //当所有状态全部还原完毕
     {
         if (MainReductionStateEvent != null)  //如果主还原函数不为空
         {
             MainReductionStateEvent.Invoke(); //执行主还原函数
         }
         nowStep  = -1;
         NowValue = DefaultValue;
     }
     else
     {
         if (stateList[nowStep].EnterAction != null)
         {
             stateList[nowStep].EnterAction.Invoke();
         }
     }
 }
예제 #2
0
 public void ReductionState()
 {
     if (ReductionStateEvent != null)
     {
         ReductionStateEvent.Invoke(NowValue);
     }
     if (TmpReductionStateEvent != null)
     {
         TmpReductionStateEvent.Invoke(NowValue);
     }
     TmpChangeStateEvent    = null;
     TmpReductionStateEvent = null;
     NowValue  = DefaultValue;
     IsSpecial = false;
 }