Ejemplo n.º 1
0
 /**
  * Cancels a previous request of removal from one of the lists that the BTExecutor handles. If
  * no such removal request was made, this method does nothing.
  *
  * @param listType
  *            the list from which the removal request will be canceled.
  * @param t
  *            the task whose removal will be canceled.
  */
 public void CancelRemovalRequest(BTExecutorList listType, ExecutionTask t)
 {
     if (listType == BTExecutorList.Open)
     {
         _currentOpenRemovals.Remove(t);
     }
     else
     {
         _currentTickableRemovals.Remove(t);
     }
 }
Ejemplo n.º 2
0
 /**
  * Method used to request the BTExecutor to remove an ExecutionTask from one of the list that
  * the BTExecutor handles. The removal is not performed right away, but delayed until:
  *
  * <ul>
  * <li>Either the current game AI cycle (call to {@link #tick()}) finishes. This happens if the
  * removal is requested in the middle of an AI cycle, that is, if <code>tick()</code> is still
  * running.
  * <li>Or the next AI cycle starts. This happens if the removal is requested when the BTExecutor
  * is not ticking the underlying BT. In this case, the next time <code>tick()</code> is called,
  * the removal will be processed just before the BT is actually ticked.
  * </ul>
  *
  * @param listType
  *            the type of the list from which the task will be removed.
  * @param t
  *            the task that wants to be removed from the list of type <code>listType</code>.
  */
 public void RequestRemovalFromList(BTExecutorList listType, ExecutionTask t)
 {
     if (listType == BTExecutorList.Open)
     {
         if (!_currentOpenRemovals.Contains(t))
         {
             _currentOpenRemovals.Add(t);
         }
     }
     else
     {
         if (!_currentTickableRemovals.Contains(t))
         {
             _currentTickableRemovals.Add(t);
         }
     }
 }
Ejemplo n.º 3
0
        /**
         * Method used to request the BTExecutor to insert an ExecutionTask into one of the list that it
         * handles. The insertion is not performed right away, but delayed until:
         *
         * <ul>
         * <li>Either the current game AI cycle (call to {@link #tick()}) finishes. This happens if the
         * insertion is requested in the middle of an AI cycle, that is, if <code>tick()</code> is still
         * running.
         * <li>Or the next AI cycle starts. This happens if the insertion is requested when the
         * BTExecutor is not ticking the underlying BT. In this case, the next time <code>tick()</code>
         * is called, the insertion will be processed just before the BT is actually ticked.
         * </ul>
         *
         * @param listType
         *            the type of the list that the task will be inserted into.
         * @param t
         *            the task that wants to be inserted into the list of type <code>listType</code>.
         */

        public void RequestInsertionIntoList(BTExecutorList listType, ExecutionTask t)
        {
            if (listType == BTExecutorList.Open)
            {
                if (!_currentOpenInsertions.Contains(t))
                {
                    _currentOpenInsertions.Add(t);
                }
            }
            else
            {
                if (!_currentTickableInsertions.Contains(t))
                {
                    _currentTickableInsertions.Add(t);
                }
            }
        }
Ejemplo n.º 4
0
 /**
  * Method used to request the BTExecutor to remove an ExecutionTask from one of the list that
  * the BTExecutor handles. The removal is not performed right away, but delayed until:
  *
  * <ul>
  * <li>Either the current game AI cycle (call to {@link #tick()}) finishes. This happens if the
  * removal is requested in the middle of an AI cycle, that is, if <code>tick()</code> is still
  * running.
  * <li>Or the next AI cycle starts. This happens if the removal is requested when the BTExecutor
  * is not ticking the underlying BT. In this case, the next time <code>tick()</code> is called,
  * the removal will be processed just before the BT is actually ticked.
  * </ul>
  *
  * @param listType
  *            the type of the list from which the task will be removed.
  * @param t
  *            the task that wants to be removed from the list of type <code>listType</code>.
  */
 public void RequestRemovalFromList(BTExecutorList listType, ExecutionTask t)
 {
     if (listType == BTExecutorList.Open)
     {
         if (!_currentOpenRemovals.Contains(t))
         {
             _currentOpenRemovals.Add(t);
         }
     }
     else
     {
         if (!_currentTickableRemovals.Contains(t))
         {
             _currentTickableRemovals.Add(t);
         }
     }
 }
Ejemplo n.º 5
0
 /**
  * Method used to request the BTExecutor to insert an ExecutionTask into one of the list that it
  * handles. The insertion is not performed right away, but delayed until:
  *
  * <ul>
  * <li>Either the current game AI cycle (call to {@link #tick()}) finishes. This happens if the
  * insertion is requested in the middle of an AI cycle, that is, if <code>tick()</code> is still
  * running.
  * <li>Or the next AI cycle starts. This happens if the insertion is requested when the
  * BTExecutor is not ticking the underlying BT. In this case, the next time <code>tick()</code>
  * is called, the insertion will be processed just before the BT is actually ticked.
  * </ul>
  *
  * @param listType
  *            the type of the list that the task will be inserted into.
  * @param t
  *            the task that wants to be inserted into the list of type <code>listType</code>.
  */
 public void RequestInsertionIntoList(BTExecutorList listType, ExecutionTask t)
 {
     if (listType == BTExecutorList.Open)
     {
         if (!_currentOpenInsertions.Contains(t))
         {
             _currentOpenInsertions.Add(t);
         }
     }
     else
     {
         if (!_currentTickableInsertions.Contains(t))
         {
             _currentTickableInsertions.Add(t);
         }
     }
 }
Ejemplo n.º 6
0
 /**
  * Cancels a previous request of removal from one of the lists that the BTExecutor handles. If
  * no such removal request was made, this method does nothing.
  *
  * @param listType
  *            the list from which the removal request will be canceled.
  * @param t
  *            the task whose removal will be canceled.
  */
 public void CancelRemovalRequest(BTExecutorList listType, ExecutionTask t)
 {
     if (listType == BTExecutorList.Open)
     {
         _currentOpenRemovals.Remove(t);
     }
     else
     {
         _currentTickableRemovals.Remove(t);
     }
 }