Exemplo n.º 1
0
 public IEnumerator fillHalfCoupleChainRoutine(NucleotideCouple head, float timeGap = 0.1F)
 {
     while (head)
     {
         head.setType(head.nucleotide1.type, getPairType(head.nucleotide1.type));
         head.setRightColor(Color.white);
         head.needHelix = true;
         head           = head.next;
         yield return(new WaitForSeconds(timeGap));
     }
 }
Exemplo n.º 2
0
    public NucleotideCouple buildCoupleChainFromTwoSingles(Nucleotide c1, Nucleotide c2, Vector3 position = default(Vector3))
    {
        if (c1.isPaired || c2.isPaired)
        {
            return(null);
        }

        if (getLengthOfSingleChain(c1) != getLengthOfSingleChain(c2))
        {
            return(null);
        }

        c1 = getHeadOfSingleChain(c1);
        if (c1 == getHeadOfSingleChain(c2))
        {
            return(null);
        }

        c2 = getTailOfSingleChain(c2);

        NucleotideCouple n    = (Instantiate(couplePrefab) as GameObject).GetComponent <NucleotideCouple>();
        NucleotideCouple head = n;

        n.setLeftColor(c1.getColor());
        n.setRightColor(c2.getColor());
        n.setType(c1.type, c2.type);
        while (c1.next)
        {
            c1     = c1.next;
            c2     = c2.prev;
            n.next = (Instantiate(couplePrefab) as GameObject).GetComponent <NucleotideCouple>();
            n.next.setLeftColor(c1.getColor());
            n.next.setRightColor(c2.getColor());
            n.next.setType(c1.type, c2.type);
            n.next.prev = n;
            n           = n.next;
        }
        head.transform.position = position;
        head.broadcastUpdateTransform();
        destroySingleChain(c1);
        destroySingleChain(c2);
        return(n);
    }