69 using System.Collections.Generic;
76 public List<GameObject>
objList =
new List<GameObject>();
88 private List<GameObject>
haloList =
new List<GameObject>();
94 mainCamera = Camera.main;
99 if(mainCamera == null)
100 mainCamera = Camera.main;
101 if (Input.GetButtonDown (
"Fire1") && GUIUtility.hotControl == 0)
103 Ray sRay= mainCamera.ScreenPointToRay (Input.mousePosition);
111 if (Physics.Raycast(sRay, out sHit))
113 Vector3 mousePos = Input.mousePosition;
114 mousePos.y = Screen.height - mousePos.y;
119 obj = sHit.collider.gameObject;
123 if(objList.IndexOf(obj) >= 0)
127 Vector3 vl=
new Vector3();
128 vl=obj.transform.localPosition;
130 halo=Instantiate(Resources.Load(
"transparentsphere"),vl,
new Quaternion(0f,0f,0f,0f)) as GameObject;
131 float rad =obj.GetComponent<SphereCollider>().radius*2;
132 halo.transform.localScale =
new Vector3(rad+1,rad+1,rad+1);
133 halo.transform.parent = obj.transform;
135 string toparse = obj.name.Split(
new string[] {
"Collider_Atom_"}, StringSplitOptions.None)[1];
136 atomnumber =
int.Parse(toparse);
140 float[] a=alist[(int)atomnumber];
179 atominfoList.Add(atominfo);
186 if(obj.GetComponent<
BallUpdate>() == null || objList.IndexOf(obj) >= 0)
191 Vector3 vl=
new Vector3();
193 vl=obj.GetComponent<Renderer>().transform.localPosition;
196 halo=Instantiate(Resources.Load(
"transparentsphere"),vl,
new Quaternion(0f,0f,0f,0f)) as GameObject;
197 float rad = obj.GetComponent<
BallUpdate>().GetRealRadius();
198 halo.transform.localScale =
new Vector3(rad+1,rad+1,rad+1);
199 halo.transform.parent = obj.transform;
201 atomnumber = obj.GetComponent<
BallUpdate>().number;
205 float[] a=alist[(int)atomnumber];
249 atominfoList.Add(atominfo);
257 if (Input.GetButtonDown(
"Fire2") && GUIUtility.hotControl == 0)
259 Ray sRay= mainCamera.ScreenPointToRay (Input.mousePosition);
263 if (Physics.Raycast(sRay, out sHit))
265 obj = sHit.collider.gameObject;
266 if(obj.name !=
"transparentsphere(Clone)")
268 int spot = haloList.IndexOf(obj);
269 Destroy(haloList[spot]);
270 objList.RemoveAt(spot);
271 haloList.RemoveAt(spot);
272 atominfoList.RemoveAt(spot);
280 if( atominfoList.Count > 0)
282 for(
int i=0; i < atominfoList.Count; i++){
283 Vector3 pos = mainCamera.WorldToScreenPoint(objList[i].transform.position);
284 GUI.Box(
new Rect (pos.x + 5, Screen.height - pos.y + 20, width, height),atominfoList[i]);}
297 foreach(GameObject halo
in haloList)
301 atominfoList.Clear();
static Rect colorPickerRect
static ColorPicker m_colorPicker
static Vector3 Offset
The offset for the molecule.
List< string > atominfoList
static List< string > atomsNamelist
The name of each atom.
static List< string > atomsChainList
The chain of each atom.
static List< AtomModel > atomsTypelist
The type of each atom.
static List< int > residueIds
The residue identifiers.
static List< float[]> CSRadiusList
static List< int[]> CSidList
!WiP Includes FLAGS of GUI.
!WiP manage GUI, and provide static strings for the GUI.
static string file_extension
static List< int > atomsNumberList
The number of each atoms (in the PDB file)
static List< string > atomsResnamelist
The name of the residue to which each atom belongs.
static List< string[]> CSLabelList
List< GameObject > objList
List< GameObject > haloList
static List< string[]> CSSGDList
static List< float[]> atomsLocationlist
The coordinates of each atom.