Ejemplo n.º 1
0
    //private void UpdateVRTKDestinations(LocationNode targetNode)
    //{
    //    for (int index = 0; index < targetNode.edges.Count; index++)
    //    {
    //        //Update the VRTKDestination based on the edge connection end point
    //        targetNode.VRTKDestinations[index].destinationLocation = targetNode.edges[index].endNode.teleportLocation;
    //        targetNode.VRTKDestinations[index].name = "ExitPoint_" + targetNode.edges[index].endNode.name;
    //    }
    //}

    //private void UpdateVRTKDestinations(LocationNode targetNode, int index)
    //{
    //    //Update the VRTKDestination based on the edge connection end point
    //    targetNode.VRTKDestinations[index].destinationLocation = targetNode.edges[index].endNode.teleportLocation;
    //    targetNode.VRTKDestinations[index].name = "ExitPoint_" + targetNode.edges[index].endNode.name;

    //}

    private void UpdateOppositeLocationNodes(LocationNodeEdge targetEdge)
    {
        LocationNode oppositeLocationNode = targetEdge.endNode;
        LocationNode currentNode          = targetEdge.startNode;

        bool hasCorrospondingExitPoint = false;

        //Does the opposite location node have a corrosponding exitpoint to this current node
        for (int x = 0; x < oppositeLocationNode.edges.Count; x++)
        {
            if (oppositeLocationNode.edges[x].endNode == currentNode)
            {
                hasCorrospondingExitPoint            = true;
                oppositeLocationNode.edges[x].weight = targetEdge.weight;
            }
        }

        if (!hasCorrospondingExitPoint)
        {
            LocationNodeEdge corrospondingEdge = new LocationNodeEdge(oppositeLocationNode, currentNode, targetEdge.weight);
            oppositeLocationNode.edges.Add(corrospondingEdge);
            AddExitPoints(oppositeLocationNode);
            //UpdateVRTKDestinations(oppositeLocationNode);
        }
    }
Ejemplo n.º 2
0
    private void AddEmptyConnection(LocationNode targetNode)
    {
        LocationNodeEdge edge = new LocationNodeEdge(targetNode, null, -1);

        targetNode.edges.Add(edge);
        AddExitPoints(targetNode);
    }
Ejemplo n.º 3
0
    private void AddNewConnection()
    {
        GameObject   newLocation = new GameObject("RENAME_ME");
        LocationNode newNode     = newLocation.AddComponent <LocationNode>();

        LocationNodeEdge edge         = new LocationNodeEdge(targetNode, newNode, -1);
        LocationNodeEdge edgeReversed = new LocationNodeEdge(newNode, targetNode, -1);


        targetNode.edges.Add(edge);
        newNode.edges.Add(edgeReversed);
    }