コード例 #1
0
        internal void InstantiateNodeView(SerializedBTNode nodeView)
        {
            BTNodeView node = new BTNodeView(nodeView);

            node.onNodeSelected += _updateInspector;
            AddElement(node);
        }
コード例 #2
0
ファイル: BTNodeView.cs プロジェクト: IvanNSBS/Roleplayer-API
        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();
        }
コード例 #3
0
        /// <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);
        }
コード例 #4
0
        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);
                }
            }
        }
コード例 #5
0
        private void InstantiateBTNode(Type t, Vector2 pos)
        {
            SerializedBTNode node = _btAsset.CreateNode(t, pos);

            InstantiateNodeView(node);
        }
コード例 #6
0
 /// <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;