Ejemplo n.º 1
0
        public override void spawnEdges()
        {
            Transform edgeAttachParent = GameObject.Find("Edges").transform;

            foreach (var nodePair in nodePairs)
            {
                EdgeComponent newEdge = GraphComponentFactory.createEdge(EdgeType.BasicEdge);

                /*
                 *  Generate edgeID just by counting existing edges;
                 *  ulong to keep consistency between other managed collections in GraphData
                 */
                ulong edgeID = System.Convert.ToUInt32(graphData.edges.Count + 1);
                newEdge.setID(edgeID);

                newEdge.setGameObjectName($"Edge_{newEdge.getID()}");

                Vector3 inPosition  = nodePair.inNode.getNodePosition();
                Vector3 outPosition = nodePair.outNode.getNodePosition();
                newEdge.setEdgePoints(inPosition, outPosition);

                // Copy metadataID from the edge starting node
                ulong copiedMetadataID = nodePair.inNode.getMetadataID();
                newEdge.assignMetadataID(copiedMetadataID);

                newEdge.analyzeMetadata();

                attachEdgeToNodes(nodePair, newEdge);

                saveEdgeToGraphData(newEdge);

                newEdge.transform.parent = edgeAttachParent;
            }
        }
Ejemplo n.º 2
0
 protected void saveEdgeToGraphData(EdgeComponent savedEdge)
 {
     graphData.edges.AddItem(savedEdge.getID(), savedEdge);
 }
Ejemplo n.º 3
0
 protected void attachEdgeToNodes(NodePair nodePair, EdgeComponent attachedEdge)
 {
     nodePair.inNode.attachEdge(outEdge: attachedEdge);
     nodePair.outNode.attachEdge(inEdge: attachedEdge);
 }