Ejemplo n.º 1
0
    public NucleotideCouple buildHalfCoupleChainFromOneSingle(Nucleotide chain)
    {
        if (chain.isPaired)
        {
            return(null);
        }

        chain = getHeadOfSingleChain(chain);
        Nucleotide nhead = chain;

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

        n.setLeftColor(chain.getColor());
        n.setType(chain.type, Nucleotide.Type.Empty);
        n.needHelix = false;
        while (chain.next)
        {
            chain  = chain.next;
            n.next = (Instantiate(couplePrefab) as GameObject).GetComponent <NucleotideCouple>();
            n.next.setLeftColor(chain.getColor());
            n.next.setType(chain.type, Nucleotide.Type.Empty);
            n.next.prev               = n;
            n.next.needHelix          = false;
            n.next.transform.rotation = nhead.transform.rotation;
            n = n.next;
        }
        head.transform.rotation = nhead.transform.rotation;
        head.transform.position = nhead.transform.position;
        head.broadcastUpdateTransform();
        destroySingleChain(chain);
        return(head);
    }
Ejemplo n.º 2
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));
     }
 }
Ejemplo n.º 3
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);
    }
Ejemplo n.º 4
0
    public NucleotideCouple String2CoupleChain(string s, Vector3 position = default(Vector3))
    {
        if (s[0] != '2')
        {
            return(null);
        }

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

        n.setType(Char2Type(s[1]), Char2Type(s[2]));
        for (int i = 3; i < s.Length; i += 2)
        {
            n.next = (Instantiate(couplePrefab) as GameObject).GetComponent <NucleotideCouple>();
            n.next.setType(Char2Type(s[i]), Char2Type(s[i + 1]));
            n.next.prev = n;
            n           = n.next;
        }
        head.transform.position = position;
        head.broadcastUpdateTransform();
        return(n);
    }