public void AddTransitionTo(StateNode other, TransitionTrigger trigger)
 {
     if (trigger == null)
     {
         StateNodeEntered  = null;
         StateNodeEntered += () => Goto(other);
     }
     else
     {
         trigger.OnTrigger += () =>
         {
             if (Active)
             {
                 trigger.FireBeforeTransition();
                 if (trigger.Valid)
                 {
                     Goto(other);
                     trigger.FireAfterTransition();
                 }
             }
         };
     }
 }
Beispiel #2
0
 internal void AddTransitionTo(State other, TransitionTrigger trigger)
 => this.ExitNode.AddTransitionTo(other.EntryNode, trigger);
 public void AddEntryTransition(int idTo, TransitionTrigger trigger)
 {
     CheckArgumentId(idTo);
     EntryNode.AddTransitionTo(states[idTo].EntryNode, trigger);
 }
 public void AddExitTransition(int idFrom, TransitionTrigger trigger)
 {
     CheckArgumentId(idFrom);
     states[idFrom].ExitNode.AddTransitionTo(ExitNode, trigger);
 }
 public void AddTransition(int idFrom, int idTo, TransitionTrigger trigger)
 {
     CheckArgumentId(idFrom);
     CheckArgumentId(idTo);
     states[idFrom].AddTransitionTo(states[idTo], trigger);
 }