示例#1
0
 public void setType(Nucleotide.Type t1, Nucleotide.Type t2)
 {
     nucleotide1.setType(t1);
     nucleotide2.setType(t2);
     if (t1 == Nucleotide.Type.A || t1 == Nucleotide.Type.T)
     {//A T只有两条氢键,要使最中间一条不显示{
         //Debug.Log("A/T has two bond");
         HydrogenBond1.SetActive(true);
         HydrogenBond2.SetActive(false);
         HydrogenBond3.SetActive(true);
     }
     else if (t1 == Nucleotide.Type.C || t1 == Nucleotide.Type.G)
     {
         HydrogenBond1.SetActive(true);
         HydrogenBond2.SetActive(true);
         HydrogenBond3.SetActive(true);
     }
     if (NucleotideDirector.getInstance().getPairType(t1) != t2 && t1 != Nucleotide.Type.Empty && t2 != Nucleotide.Type.Empty)
     {
         nucleotide1.gameObject.GetComponent <Renderer>().material.color = Color.red;
         nucleotide2.gameObject.GetComponent <Renderer>().material.color = Color.red;
         HydrogenBond1.SetActive(false);
         HydrogenBond2.SetActive(false);
         HydrogenBond3.SetActive(false);
     }
     if (t1 == Nucleotide.Type.Empty || t2 == Nucleotide.Type.Empty)
     {
         HydrogenBond1.SetActive(false);
         HydrogenBond2.SetActive(false);
         HydrogenBond3.SetActive(false);
     }
 }
示例#2
0
    private void buildNucleotide()
    {
        Nucleotide n = (Instantiate(prefab) as GameObject).GetComponent <Nucleotide>();

        n.setType(type);
        n.transform.position = this.transform.position;
        n.transform.rotation = this.transform.rotation;
    }
示例#3
0
    public Nucleotide String2SingleChain(string s, Vector3 position = default(Vector3))
    {
        if (s[0] != '1')
        {
            return(null);
        }

        Nucleotide n    = (Instantiate(singlePrefab) as GameObject).GetComponent <Nucleotide>();
        Nucleotide head = n;

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