Esempio n. 1
0
        /// <summary>
        /// Duplicates a Behavior Tree
        /// </summary>
        /// <param name="other">Behavior tree to copy</param>
        /// <returns>Behavior tree copy</returns>
        public static MoonBT CopyBT(MoonBT other)
        {
            if (!other)
            {
                return(null);
            }
            MoonBT   bt    = Instantiate(other);
            Decision _root = Instantiate(bt.Root);

            bt.Tasks = AddChilds(_root).ToList();
            bt.Root  = _root;
            return(bt);
        }
Esempio n. 2
0
 /// <summary>
 /// Loads behavior tree instance
 /// </summary>
 public void LoadBTInstance()
 {
     if (BehaviorTree != null && BehaviorTree.IsValid())
     {
         BTInstance = MoonBT.CopyBT(BehaviorTree);
     }
     else
     {
         Debug.LogWarning("[MoonBehavior] " + name + ": Invalid BehaviorTree");
         enabled = false;
         return;
     }
 }