public void makeNewBranchNode() { GameObject newNode = (GameObject)Instantiate(branchPrefab); SetBranchNode nodeSettings = newNode.GetComponent <SetBranchNode>(); nodeSettings.setUpNode(lineCam, connectCallObject); nodeSettings.setEnlosingType(enclosingTypeSetter); newNode.transform.SetParent(worldCanvas.transform, false); newNode.transform.position = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width / 2f, Screen.height / 2f, 0)); allNodes.Add(newNode); }
public GameObject newBranchNode(XmlNode node, GameObject connectToNode, int xCoord, int yCoord) //Returns the out port of that node it makes //Debug.Log("Branch Node: " + node.Name + " X Coord: " + xCoord + " Y Coord : " + yCoord); { GameObject newNode = (GameObject)Instantiate(branchPrefab); SetBranchNode nodeSettings = newNode.GetComponent <SetBranchNode>(); nodeSettings.setUpNode(lineCam, connectCallObject); if (connectToNode != null) { nodeSettings.setInConnection(connectToNode); } nodeSettings.setEnlosingType(node.Name); newNode.transform.SetParent(worldCanvas.transform, false); newNode.transform.position = new Vector3(550f * xCoord, 150f * yCoord, 0f); newNode.transform.position += gameObject.transform.position; connectToNode.GetComponent <BranchPort>().branches.Add(nodeSettings.inPort); allNodes.Add(newNode); return(nodeSettings.outPort); }