Ejemplo n.º 1
0
    private void AdjustNodeReferenceInInstruction(BuilderTempInstruction tempInst, GameObject nodeGO)
    {
        int indexOfNodeToRemove = nodes.IndexOf(nodeGO);
        int baseNodePosition    = nodes.IndexOf(tempInst.baseNode);
        int tailNodePosition    = nodes.IndexOf(tempInst.tailNode);

        if (baseNodePosition > indexOfNodeToRemove)
        {
            tempInst.baseNode = nodes[baseNodePosition--];
        }
        if (tailNodePosition > indexOfNodeToRemove)
        {
            tempInst.tailNode = nodes[tailNodePosition--];
        }
    }
Ejemplo n.º 2
0
    private void DeleteJointsConnectedToNode(GameObject node)
    {
        int count = tempJoints.Count;

        for (int i = 0; i < count; i++)
        {
            BuilderTempInstruction bti = tempJoints.ElementAt(i);
            if (node == bti.baseNode || node == bti.tailNode)
            {
                Destroy(bti.joint);
                tempJoints.Remove(bti);
                i--;
                count = tempJoints.Count;
            }
            AdjustNodeReferenceInInstruction(bti, node);
        }
    }