Example #1
0
 public virtual void OnExit(ENST state)
 {
     this.Running = false;
     this.State   = state;
     for (int i = 0; i < Children.Count; i++)
     {
         Children[i].OnExit(state);
     }
 }
Example #2
0
 public void OnTick()
 {
     if (State == ENST.INITIAL)
     {
         bool checkCondition = OnEnter();
         this.State = checkCondition ? ENST.RUNNING : ENST.FAILURE;
     }
     if (State == ENST.RUNNING)
     {
         ENST nodeStatus = OnExecute();
         this.Running = nodeStatus == ENST.RUNNING;
         this.State   = nodeStatus;
     }
     else
     {
         this.Running = false;
     }
 }