Ejemplo n.º 1
0
 /// <summary>Unsets the root node of the behavior tree if the given node matches the root.</summary>
 public void UnsetRoot(BTBranchNode node)
 {
     // Only unset when the state passed is the same as the current one.
     if (node == root)
     {
         root = null;
     }
 }
Ejemplo n.º 2
0
 /// <summary>Sets the root node of the behavior tree.</summary>
 public void SetRoot(BTBranchNode node)
 {
     // Unset previous root.
     if (root != null)
     {
         root.IsRoot = false;
     }
     // Set new root.
     root = node;
 }
Ejemplo n.º 3
0
        /// <summary>Draw node's body GUI.</summary>
        public override void OnBodyGUI()
        {
            base.OnBodyGUI();

            _branch = target as BTBranchNode;

            // Show parent port only if node is not root.
            if (!_branch.IsRoot)
            {
                GUILayout.BeginHorizontal();
                NodePort port = _branch.GetInputPort("_parent");
                NodeEditorGUILayout.PortField(port, GUILayout.Width(60));
                GUILayout.EndHorizontal();
            }
        }