Ejemplo n.º 1
0
        public virtual EdgeConnector[] GetReceivingEdgeConnectors()
        {
            var l = new EdgeConnector[]
            {
                new EdgeConnector(0, 0, new Rect(node.editorPosition.x + nodeSize.x / 2f - EdgeConnectorSize / 2f + editor.nodesOffset.x, node.editorPosition.y - EdgeConnectorSize + editor.nodesOffset.y, EdgeConnectorSize, EdgeConnectorSize), false, this)
            };

            return(l);
        }
Ejemplo n.º 2
0
        public void SetEdge(EdgeConnector connector, NodeBase connectToNode)
        {
//            Debug.Log("Connect " + node.index + " to " + connectToNode.index);
            if (connector.isHelperConnector == false && connector.index <= node.edges.Length - 1)
            {
                var existingNode = node.edges[connector.index];
                if (existingNode != null)
                {
                    existingNode.toNodeIndex = connectToNode.index;
                }
            }
            else
            {
                var l = this.node.edges.ToList();
                l.Insert(connector.index, new Edge(connectToNode.index));

                this.node.edges = l.ToArray();
            }
        }
Ejemplo n.º 3
0
        public virtual EdgeConnector[] GetEdgeConnectors()
        {
            var l = new EdgeConnector[Mathf.Min(node.edges.Length * 2 + 1, maxOutgoingEdges == node.edges.Length ? maxOutgoingEdges : node.edges.Length * 2 + 1)];

            var r = new Rect(node.editorPosition.x + nodeSize.x / 2f - EdgeConnectorSize / 2f * l.Length, node.editorPosition.y + nodeSize.y, EdgeConnectorSize, EdgeConnectorSize);

            r.position += editor.nodesOffset;
            int index = 0;

            for (int i = 0; i < l.Length; i++)
            {
                var isHelper = i % 2 == 0;
                if ((maxOutgoingEdges == node.edges.Length || isHelper) && i > 0)
                {
                    index++;
                }

                var con = new EdgeConnector(index, i, r, isHelper && maxOutgoingEdges != node.edges.Length, this);
                l[i] = con;
                r.x += EdgeConnectorSize;
            }

            return(l);
        }