예제 #1
0
 /// <summary>
 /// return the natural next state for the action when is actually "updating" 
 /// </summary>
 /// <param name="instance"></param>
 /// <returns></returns>
 private ActionInstance.State NextState(Action instance)
 {
     if (instance.components.action_instance.state == ActionInstance.State.Queued) return ActionInstance.State.Start;
     if (instance.components.action_instance.state == ActionInstance.State.Start) return ActionInstance.State.Updating;
     if (instance.components.action_instance.state == ActionInstance.State.Suspended) return ActionInstance.State.Updating;
     if (instance.components.action_instance.state == ActionInstance.State.Updating)
     {
         if (instance.Goal())
         {
             return ActionInstance.State.Succeed;
         }
         if (instance.Fail())
         {
             return ActionInstance.State.Failed;
         }
     }
     return instance.components.action_instance.state;
 }