Example #1
0
        /// <summary>
        /// Tick the tree
        /// </summary>
        public void Tick()
        {
            _tree.Tick();
            var status = _tree.status;

            if (status != Status.Running)
            {
                Task.current.Complete(status == Status.Succeeded);
            }
        }
 // Update is called once per frame
 void Update()
 {
     if (Time.timeScale != 0.0f)
     {
         if (tree.GetStatus() == StatusValue.RUNNING)
         {
             tree.Tick();
         }
         if (tree.GetStatus() != StatusValue.RUNNING)
         {
             tree.BeginTree();
         }
     }
     UpdateDebugText();
 }
 // Update is called once per frame
 void Update()
 {
     //Debug.Log(tree.GetStatus().ToString());
     if (Time.timeScale != 0.0f)
     {
         tree.Blackboard.SetValue("MyHealthAsPercentage", GetHealthAsPercentage());
         if (tree.GetStatus() == StatusValue.RUNNING)
         {
             tree.Tick();
         }
         //restart the tree when all of the nodes have returned
         if (tree.GetStatus() != StatusValue.RUNNING)
         {
             tree.BeginTree();
         }
     }
     UpdateDebugText();
 }