private void OnClickAddNode(Vector2 mousePosition, DrawableInfo info) { if (nodes == null) { nodes = new List <Node> (); } nodes.Add(new Node(mousePosition, 350, 50, nodeStyle, selectedNodeStyle, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, info)); }
private void OnClickAddNode(Vector2 mousePosition, DrawableInfo info) { if (nodes == null) { nodes = new List <Node> (); Debug.Log("Nodes list are null so a new list is created"); } Debug.Log("nodes lenght = " + nodes.Count); nodes.Add(new Node(mousePosition, 350, 50, nodeStyle, selectedNodeStyle, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, info)); }
public Node(Vector2 position, float width, float height, GUIStyle nodeStyle, GUIStyle selectedStyle, GUIStyle inPointStyle, GUIStyle outPointStyle, Action <ConnectionPoint> OnClickInPoint, Action <ConnectionPoint> OnClickOutPoint, Action <Node> OnClickRemoveNode, DrawableInfo info) { nodeRect = new Rect(position.x, position.y, width, height); style = nodeStyle; inPoint = new ConnectionPoint(this, ConnectionPointType.In, inPointStyle, OnClickInPoint); outPoint = new ConnectionPoint(this, ConnectionPointType.Out, outPointStyle, OnClickOutPoint); defaultNodeStyle = nodeStyle; selectedNodeStyle = selectedStyle; OnRemoveNode = OnClickRemoveNode; myInfo = info; myInfo.style = style; collectiveRect = new Rect(nodeRect.position.x, nodeRect.position.y, nodeRect.size.x, nodeRect.size.y + myInfo.GetHeight() + (nodeRect.size.y / 2f)); }