コード例 #1
0
 //-----------------------------------------------------------------------------------------------
 public void RestoreToLastDecomposedTask(
     out CompoundTask lastDecomposedTask, out Plan lastPlan, out Stack <Task> lastTaskHistory)
 {
     lastDecomposedTask = m_taskHistory.Pop();
     lastPlan           = m_planHistory.Pop();
     lastTaskHistory    = m_decompHistory.Pop();
 }
コード例 #2
0
ファイル: CompoundTask.cs プロジェクト: DylanSByrd/Thesis
      //-----------------------------------------------------------------------------------------------
      public override Task Clone()
      {
         CompoundTask clone = new CompoundTask(m_name, m_modifierMask);

         clone.m_methods = m_methods;

         return clone;
      }
コード例 #3
0
        //-----------------------------------------------------------------------------------------------
        public void RecordTaskDecomposition(
            CompoundTask currentTask, Plan currentPlan, Stack <Task> decompHistory)
        {
            m_taskHistory.Push(currentTask);

            Plan planCopy = currentPlan.Clone();

            m_planHistory.Push(planCopy);

            Stack <Task> decompClone = new Stack <Task>(decompHistory);

            m_decompHistory.Push(decompClone);
        }
コード例 #4
0
ファイル: Planner.cs プロジェクト: DylanSByrd/Thesis
        //-----------------------------------------------------------------------------------------------
        private void HandleCompoundTask(CompoundTask task)
        {
            Method satisfiedMethod = task.FindSatisfiedMethod(m_workingWorldState);

            if (satisfiedMethod != null)
            {
                m_planHistory.RecordTaskDecomposition(task, m_finalPlan, m_tasksToProcess);
                DecomposeMethodAndAddToProcessStack(satisfiedMethod, task);
            }
            else
            {
                RestoreToLastDecomposedTask();
            }
        }
コード例 #5
0
ファイル: Planner.cs プロジェクト: DylanSByrd/Thesis
        //-----------------------------------------------------------------------------------------------
        private void DecomposeMethodAndAddToProcessStack(Method method, CompoundTask task)
        {
            List <Method.TaskWithModifiers> methodTasks = method.Subtasks;

            for (int taskIndex = (methodTasks.Count - 1); taskIndex >= 0; --taskIndex)
            {
                // Clone so we can store modifiers
                Task taskToPush = methodTasks[taskIndex].StoredTask.Clone();

                if (methodTasks[taskIndex].StoredMods != null)
                {
                    foreach (Task.eModifier mod in methodTasks[taskIndex].StoredMods)
                    {
                        taskToPush.AddModifier(mod);
                    }
                }

                // Also add parent task's modifiers!
                taskToPush.CombineModifierMasks(task.ModifierMask);

                m_tasksToProcess.Push(taskToPush);
            }
        }