Ejemplo n.º 1
0
        /// <summary>
        /// Will be executed frequently to check whether this task/subtree is ready to run.
        /// </summary>
        /// <returns>Returns true if the task/subtree is ready and can be started; otherwise, false.</returns>
        public override bool CheckConditions()
        {
            if (active != null)
            {
                return(true);
            }

            do
            {
                if (impulses.Count == 0)
                {
                    active = null;
                    return(false);
                }

                active = impulses[0];
                impulses.Remove(active);
                string sourceName = sourceVariable;
                if (sourceName.Length > 0)
                {
                    Context.Variables[sourceName] = active.Source;
                }
                string dataName = dataVariable;
                if (dataName.Length > 0)
                {
                    Context.Variables[dataName] = active.Data;
                }
            } while (!Subtask.CheckConditions());

            return(true);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Will be executed each frame while the task is running.
 /// </summary>
 public override void DoAction()
 {
     if (!Subtask.Started)
     {
         if (Subtask.CheckConditions())
         {
             Subtask.SafeStart();
         }
     }
     else if (Subtask.Finished)
     {
         Subtask.Reset();
     }
     else
     {
         Subtask.DoAction();
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Will be executed each frame while the task is running.
 /// </summary>
 public override void DoAction()
 {
     if (!Subtask.Finished)
     {
         Subtask.DoAction();
     }
     else
     {
         Subtask.SafeEnd();
         if (Subtask.CheckConditions())
         {
             Subtask.SafeStart();
         }
         else
         {
             Finish();
         }
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Will be executed each frame while the task is running.
 /// </summary>
 public override void DoAction()
 {
     Subtask.DoAction();
     if (Subtask.Finished)
     {
         if (++iteration < iterations)
         {
             Subtask.Reset();
             if (Subtask.CheckConditions())
             {
                 Subtask.SafeStart();
             }
             else
             {
                 Finish();
             }
         }
         else
         {
             Finish();
         }
     }
 }
 /// <summary>
 /// Will be executed frequently to check whether this task/subtree is ready to run.
 /// </summary>
 /// <returns>Returns true if the task/subtree is ready and can be started; otherwise, false.</returns>
 public override bool CheckConditions()
 {
     return(TaskContext <DataType> .GlobalSemaphores[identifier] < concurrentExecutions && Subtask.CheckConditions());
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Will be executed frequently to check whether this task/subtree is ready to run.
 /// </summary>
 /// <returns>Returns true if the task/subtree is ready and can be started; otherwise, false.</returns>
 public override bool CheckConditions()
 {
     conditions = Subtask.CheckConditions();
     return(true);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Will be executed frequently to check whether this task/subtree is ready to run.
 /// </summary>
 /// <returns>Returns true if the task/subtree is ready and can be started; otherwise, false.</returns>
 public override bool CheckConditions()
 {
     return(Subtask.CheckConditions());
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Will be executed frequently to check whether this task/subtree is ready to run.
 /// </summary>
 /// <returns>Returns true if the task/subtree is ready and can be started; otherwise, false.</returns>
 public override bool CheckConditions()
 {
     return(Context.LocalSemaphores[identifier] < concurrentExecutions && Subtask.CheckConditions());
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Will be executed frequently to check whether this task/subtree is ready to run.
 /// </summary>
 /// <returns>Returns true if the task/subtree is ready and can be started; otherwise, false.</returns>
 public override bool CheckConditions()
 {
     return(iterations > 0 && Subtask.CheckConditions());
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Will be executed frequently to check whether this task/subtree is ready to run.
 /// </summary>
 /// <returns>Returns true if the task/subtree is ready and can be started; otherwise, false.</returns>
 public override bool CheckConditions()
 {
     return(nextAction <= Context.Time && Subtask.CheckConditions());
 }