internal void InstantiateNodeView(SerializedBTNode nodeView) { BTNodeView node = new BTNodeView(nodeView); node.onNodeSelected += _updateInspector; AddElement(node); }
public BTNodeView(SerializedBTNode node) : base(UXML_PATH) { _node = node; title = node.name; viewDataKey = node.guid; style.left = node.pos.x; style.top = node.pos.y; CreateInputPorts(); CreateOutputPorts(); AddUssClasses(); }
/// <summary> /// Sets the decorator child /// </summary> /// <param name="child"></param> /// <returns></returns> public override bool AddChild(SerializedBTNode child) { if (childs.Count == 1) { var oldChild = childs[0]; RemoveChild(oldChild); } child.parent = this; childs.Add(child); return(true); }
private void CreateEdges(SerializedBTNode node) { var childs = node.childs; if (childs != null && childs.Count > 0) { BTNodeView parentView = GetNodeByGuid(node.guid) as BTNodeView; foreach (var child in childs) { var childView = GetNodeByGuid(child.guid) as BTNodeView; var edge = parentView.ConnectTo(childView.GetInput()); AddElement(edge); } } }
private void InstantiateBTNode(Type t, Vector2 pos) { SerializedBTNode node = _btAsset.CreateNode(t, pos); InstantiateNodeView(node); }
/// <summary> /// Tries to add a child to the SerializedAction node. /// However, Actions can't have childs so it will always return false /// </summary> /// <param name="child"></param> /// <returns></returns> public override bool AddChild(SerializedBTNode child) => false;