Пример #1
0
    public List <Nucleotide> buildSingleChainsFromCouple(NucleotideCouple head)
    {
        Nucleotide       leftHead, left, rightTail, right;
        NucleotideCouple curr = head;

        leftHead  = left = (Instantiate(singlePrefab) as GameObject).GetComponent <Nucleotide>();
        rightTail = right = (Instantiate(singlePrefab) as GameObject).GetComponent <Nucleotide>();
        left.setType(curr.getLeftType());
        left.setColor(curr.getLeftColor());
        right.setType(curr.getRightType());
        right.setColor(curr.getRightColor());

        leftHead.transform.rotation  = curr.nucleotide1.transform.rotation;
        leftHead.transform.position  = curr.nucleotide1.transform.position + leftHead.transform.rotation * Vector3.left * 2.0F;
        rightTail.transform.rotation = curr.nucleotide2.transform.rotation;
        rightTail.transform.position = curr.nucleotide2.transform.position + rightTail.transform.rotation * Vector3.left * 2.0F;

        curr = curr.next;
        while (curr)
        {
            Nucleotide leftPrev, rightPrev;
            leftPrev      = left;
            left          = (Instantiate(singlePrefab) as GameObject).GetComponent <Nucleotide>();
            leftPrev.next = left;
            left.prev     = leftPrev;
            left.setType(curr.getLeftType());
            left.setColor(curr.getLeftColor());

            rightPrev      = right;
            right          = (Instantiate(singlePrefab) as GameObject).GetComponent <Nucleotide>();
            right.next     = rightPrev;
            rightPrev.prev = right;
            right.setType(curr.getRightType());
            right.setColor(curr.getRightColor());

            curr = curr.next;

            /*if (head)
             *      Destroy(head.prev);*/
        }
        leftHead.broadcastUpdateTransform();
        rightTail.broadcastUpdateTransform();

        destroyCoupleChain(head);

        List <Nucleotide> result = new List <Nucleotide>();

        result.Add(leftHead);
        result.Add(rightTail);
        return(result);
    }
Пример #2
0
    public string CoupleChain2String(NucleotideCouple chain)
    {
        NucleotideCouple n      = getHeadOfCoupleChain(chain);
        string           result = "2";

        while (n)
        {
            result += Type2Char(n.getLeftType()) + Type2Char(n.getRightType());
            n       = n.next;
        }
        return(result);
    }