public static BehaviorNodeConfig AddChild(this BehaviorTreeConfig treeConfig, BehaviorNodeConfig parent, BehaviorNodeConfig child) { child.transform.parent = parent.transform; child.transform.SetAsLastSibling(); child.GetComponent <BehaviorNodeConfig>().id = treeConfig.RootNodeId + treeConfig.AutoId; return(child.GetComponent <BehaviorNodeConfig>()); }
public static BehaviorNodeConfig AddRootNode(this BehaviorTreeConfig treeConfig, string rootName) { BehaviorNodeConfig go = treeConfig.CreateNodeConfig(rootName); treeConfig.RootNodeConfig = go.GetComponent <BehaviorNodeConfig>(); treeConfig.RootNodeConfig.id = BTEditor.NodeIdStartIndex; go.gameObject.name = rootName; return(go); }