Esempio n. 1
0
    void ConnectNodeToSelected(Node node)
    {
        if (selectedNode != null)
        {
            node.ConnectNodeToEdge(selectedNode.GetIndex());

            // create a connection game object
            GameObject             connectionGO = Instantiate(connectionPrefab);
            LineRendererController lRC          = connectionGO.GetComponent <LineRendererController>();

            lRC.Setup(node.transform, selectedNode.transform);

            connectionGO.transform.parent = node.transform;
        }
    }
Esempio n. 2
0
    public void LoadTrack()
    {
        NodeData[] nodeData = SaveSystem.LoadTrack();
        foreach (NodeData nD in nodeData)
        {
            CreateNodeFromExistingData(nD);
        }

        // then create the connections
        foreach (Node n in nodes)
        {
            foreach (int connection in n.GetEdgeConnections())
            {
                // create a connection game object
                GameObject             connectionGO = Instantiate(connectionPrefab);
                LineRendererController lRC          = connectionGO.GetComponent <LineRendererController>();

                lRC.Setup(n.transform, nodes[connection].transform);

                connectionGO.transform.parent = n.transform;
            }
        }
    }