Esempio n. 1
0
        public override void OnStart()
        {
            int count = ChildCount();

            ChildStatuses = new Status[count];

            // Set the branch iterators. Branch iterators have this parallel node as their root.
            // Offset level order by +1 since the parallel parent is not included in branch traversal.
            BranchIterators = Enumerable
                              .Range(0, count)
                              .Select(i => new BehaviourIterator(Tree, levelOrder + 1))
                              .ToArray();

            // Assign the branch iterator to nodes not under any parallel nodes.
            // Children under parallel nodes will have iterators assigned by the local parallel parent.
            // Each branch under a parallel node use their own branch iterator.
            for (int i = 0; i < count; i++)
            {
                BehaviourIterator branchIterator = BranchIterators[i];
                foreach (BehaviourNode node in TreeTraversal.PreOrderSkipChildren(GetChildAt(i), n => n is ParallelComposite))
                {
                    node.Iterator = branchIterator;
                }
            }
        }
 private void SetRootIteratorReferences()
 {
     // Assign the main iterator to nodes not under any parallel nodes.
     // Children under parallel nodes will have iterators assigned by the parallel parent.
     // Each branch under a parallel node use their own branch iterator.
     foreach (BehaviourNode node in TreeTraversal.PreOrderSkipChildren(Root, n => n is ParallelComposite))
     {
         node.Iterator = mainIterator;
     }
 }