/// <summary>
 /// <para>Start traversing the tree from the root.
 /// Can only be done if the tree is not yet running.
 /// </para>
 /// The tree should be initialized before calling this.
 /// <see cref="Start"/>
 /// </summary>
 public void BeginTraversal()
 {
     if (isTreeInitialized && !mainIterator.IsRunning)
     {
         mainIterator.Traverse(Root);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Preprocesses and starts the tree.
        /// </summary>
        /// <param name="root"></param>
        public void Start()
        {
            if (_root == null)
            {
                Debug.LogWarning("Cannot start tree with a null root.");
                return;
            }

            PreProcess();

            for (int i = 0; i < allNodes.Count; ++i)
            {
                allNodes[i].OnStart();
            }

            _mainIterator.Traverse(_root);
            _bTreeInitialized = true;
        }