예제 #1
0
    public void InstantiateEdge()
    {
        if (createStandardGraph)
        {
            currentEdgeIndex    = 0;
            createStandardGraph = false;
        }

        if (GameObject.FindGameObjectWithTag("EdgeContent").transform.childCount == 1)
        {
            currentEdgeIndex = 0;
        }

        //Edge-Liste aktualisieren
        edges = ccont.GetAllEdges();

        edgeStart.text = ccont.GetV1();
        edgeEnd.text   = ccont.GetV2();

        edgeStart.name = edgeStart.text + "(Edge)";
        edgeEnd.name   = edgeEnd.text + "(Edge)";

        edgeStartList.Add(ccont.GetV1());
        edgeEndList.Add(ccont.GetV2());
        Debug.Log("CurrentEdgeIndex: " + currentEdgeIndex);
        edgeCapacity.text = edges[currentEdgeIndex].getCapacity().ToString();

        isEdge = true;
        if (isEdge)
        {
            edgeName.text = nameGen.GenerateEdgeName();
        }
        if (!isEdge)
        {
            vertexName.text = nameGen.GenerateVertexName();
        }

        //Instanzierung des Prefabs
        GameObject edgeInTable = Instantiate(edgePrefab, edgeParent.transform);

        currentEdgeIndex = edgeInTable.transform.GetSiblingIndex();

        edgeInTable.name = edgeInTable.name.Replace("(Clone)", "");
        edgeInTable.name = ccont.GetV1() + " zu " + ccont.GetV2();
    }