Beispiel #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);
     }
 }
Beispiel #2
0
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Nucleotide")
     {
         // NucleotideDirector.getInstance().buildCoupleChainFromOneSingle(other.gameObject.GetComponent<Nucleotide>());
         NucleotideDirector.getInstance().buildCoupleChainFromOneSingleAnimation(other.gameObject.GetComponent <Nucleotide>(), 0.8F);
     }
 }
Beispiel #3
0
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == "NucleotideCouple")
     {
         Debug.Log("duplicate");
         NucleotideCouple chain = other.gameObject.GetComponent <NucleotideCouple>();
         NucleotideDirector.getInstance().duplicateCoupleChain(chain);
     }
 }
Beispiel #4
0
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Nucleotide")
     {
         Nucleotide n = other.gameObject.GetComponent <Nucleotide>();
         if (waiting)
         {
             NucleotideDirector.getInstance().buildCoupleChainFromTwoSingles(waiting, n, transform.position);
             waiting = null;
         }
         else
         {
             waiting = n;
         }
     }
 }
Beispiel #5
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Nucleotide")
        {
            Nucleotide n = other.gameObject.GetComponent <Nucleotide>();
            if (isHead && !attached && !n.isPaired && !parent.isPaired)
            {
                if (parent.addPrev(n))
                {
                    attached = true;
                }
            }
        }
        else if (other.tag == "cut")          //判断parent上下的核苷酸类型再cutPrev
        {
            if (attached)
            {
                Cutter             cutter = GameObject.Find("Knife").GetComponent <Cutter>();
                NucleotideDirector n      = NucleotideDirector.getInstance();//GameObject.Find("NucleotideDirector").GetComponent<NucleotideDirector>();
                Nucleotide         tmp    = parent;
                string             before = cutter.seqBeforeCutPoint;
                string             after  = cutter.seqAfterCutPoint;
                //Debug.Log(before);
                //Debug.Log(after);
                for (int i = before.Length - 1; i >= 0; i--)
                {
                    if (tmp.prev)
                    {
                        if (n.Char2Type(before[i]) == tmp.prev.type)
                        {
                            tmp = tmp.prev;
                        }
                        else
                        {
                            return; //没有对应,不能割
                        }
                    }
                    else
                    {
                        return;//没有足够核苷酸对应before序列,肯定不能割
                    }
                }
                tmp = parent;
                for (int i = 0; i < after.Length; i++)
                {
                    if (tmp)
                    {
                        if (n.Char2Type(after[i]) == tmp.type)
                        {
                            tmp = tmp.next;
                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }
                }

                //cutter.exchangeSeq();切一次成功后要对调切割点前后seq,以便切另一边
                attached = false;
                parent.cutPrev();
            }
        }
    }
Beispiel #6
0
 void Awake()
 {
     instance = this;
 }