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); } }
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; }
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); }