Пример #1
0
 public virtual void DoExit(StateExitEventArgs args)
 {
     if (OnExit != null)
     {
         OnExit(this, args);
     }
 }
Пример #2
0
        public virtual bool RunTrigger(IStateParam param, StateMachine sm)
        {
            //if (!sm.CheckState(FromState))
            //{
            //    throw new NotCurrentStateException(sm.GetType().ToString() + " : current is " + sm.CurrentState.StateName + ",not Transition from: " + FromState.StateName);
            //}

            StateExitEventArgs seea = new StateExitEventArgs();

            try { FromState.DoExit(seea); }
            catch (Exception ex) { throw ex; }

            try { runAct.Invoke(sm, null); }
            catch (Exception ex) { throw ex; }

            StateEntryEventArgs senea = new StateEntryEventArgs(sm);

            try { ToState.ExecDoEntry(senea); }
            catch (Exception ex) { throw ex; }


            return(true);
        }
Пример #3
0
 public override bool RunTrigger(IStateParam param, StateMachine sm)
 {
     try
     {
         StateExitEventArgs seea = new StateExitEventArgs();
         FromState.DoExit(seea);
     }
     catch
     {
         throw new StateMachineFatelException(FromState.StateName + ": get exit fail event");
     }
     runAct.Invoke(sm, null);
     try
     {
         StateEntryEventArgs seea = new StateEntryEventArgs(sm);
         ToState.ExecDoEntry(seea);
     }
     catch
     {
         throw new StateMachineFatelException(ToState.StateName + ": get entry fail event");
     }
     return(true);
 }