70     using System.Collections;
    71     using System.Collections.Generic;
    79         private float[] scale=
new float[7];
    82         private Camera mainCamera = null;
    84         public static GameObject AtomCubeParent = 
new GameObject(
"AtomCubeParent");
   103             if(mainCamera == null)
   104                 mainCamera = Camera.main;
   110                     if(AtomCubeParent == null)
   111                         AtomCubeParent = 
new GameObject(
"AtomCubeParent");
   113                     AtomCubeParent.tag = 
"HBCubes";
   121                     atomtype = type_atom;
   122                     DisplayAtomMethodByCube();
   162             if (hexColor.IndexOf(
'#') != -1)
   163                 hexColor = hexColor.Replace(
"#", 
"");
   169             if (hexColor.Length == 6) {
   171                 red = 
int.Parse(hexColor.Substring(0, 2), NumberStyles.AllowHexSpecifier);
   172                 green = 
int.Parse(hexColor.Substring(2, 2), NumberStyles.AllowHexSpecifier);
   173                 blue = 
int.Parse(hexColor.Substring(4, 2), NumberStyles.AllowHexSpecifier);
   174             } 
else if (hexColor.Length == 3) {
   176                 red = 
int.Parse(hexColor[0].ToString() + hexColor[0].ToString(), NumberStyles.AllowHexSpecifier);
   177                 green = 
int.Parse(hexColor[1].ToString() + hexColor[1].ToString(), NumberStyles.AllowHexSpecifier);
   178                 blue = 
int.Parse(hexColor[2].ToString() + hexColor[2].ToString(), NumberStyles.AllowHexSpecifier);
   181             Color hexcolor= 
new Color(red/255f,green/255f,blue/255f);
   187             Debug.Log(
"Entering :: AtomListByAxisOrder");
   188             ArrayList atomListByOrder=
new ArrayList();
   190             for(
int i=0;i<alist.Count;i++) {
   221                 float[] atom=
new float[5];
   222                 atom[0]=(alist[i] as 
float[])[0];
   223                 atom[1]=(alist[i] as 
float[])[1];
   224                 atom[2]=(alist[i] as 
float[])[2];
   227                 atomListByOrder.Add(atom);
   232             return atomListByOrder;
   240             List<GameObject> goList = 
new List<GameObject>();
   241             for(
int i=0; i < coordinates.Count; i++){
   242                 goList.Add(CreateAtomHB(i, coordinates, atomModels));
   247                 GameObject hbManagerObj = GameObject.FindGameObjectWithTag(
"HBallManager");
   252                 GameObject hbmeshManagerObj = GameObject.FindGameObjectWithTag(
"HBallMeshManager");
   254                 hbmeshManager.
Init();
   257                 GameObject cubeManagerObj = GameObject.FindGameObjectWithTag(
"CubeManager");
   266             Color c = 
new Color();
   267             Vector3 v = 
new Vector3();
   288             int Number=atomsLocation.Count;
   290             for(
int k=0;k<Number;k++) {
   291                 int order=(int)((atomOrderListArray[iType] as ArrayList)[k]);
   295                     v=
new Vector3(pointradius,pointradius,pointradius);
   300                     CreateAtomHB(iType,k,atomsLocation,c,v,order);
   305                     CreateAtomRC(iType,k,(k+1),atomsLocation,c,v,order);
   307                     CreateAtomRCBB(iType,k,(k+1),atomsLocation,c,v,order);
   309                     CreateAtomHBBB(iType,k,(k+1),atomsLocation,c,v,order);
   311                     CreateAtomRCSprite(iType,k,(k+1),atomsLocation,c,v,order);
   313                     CreateAtomMtHyperBall(iType,k,(k+1),atomsLocation,c,v,order);
   315                     CreateCombineMeshHyperBall(iType,k,(k+1),atomsLocation,c,v,order);
   317                     CreateAtomHB(iType,k,atomsLocation,c,v,order);
   337         private GameObject 
CreateAtomHB(
int iAtom, IList coordinates, IList atomModels) {   
   341                 Atom = (GameObject)GameObject.Instantiate(Resources.Load(
"CubeHBPrefab"));
   343                 Atom = (GameObject)GameObject.Instantiate(Resources.Load(
"CubeCubePrefab"));
   345             Atom.SetActive(
true);
   347             float[]  fLocation = coordinates[iAtom] as 
float[];
   348             Vector3 location=
new Vector3(fLocation[0],fLocation[1],fLocation[2]);
   352             Atom.transform.Translate(location);
   353             Atom.transform.parent = AtomCubeParent.transform;
   374                     Atom.GetComponent<
BallUpdateHB>().z=(
float)(fLocation[2]);
   398             Atom.GetComponent<Renderer>().material.SetColor(
"_Color", comp.
atomcolor);
   403             Atom.tag = atomModel.
type;
   406                 Atom.GetComponent<Renderer>().enabled = 
false;
   408             BoxCollider collider = Atom.GetComponent<Collider>() as BoxCollider;
   409             float newSize = atomModel.
radius * 60 / 100;
   410             collider.size = 
new Vector3(newSize,newSize,newSize);
   415             link.
index = (int)fLocation[3];
   422         private void CreateAtomHB(
int iType, 
int iAtom, ArrayList atomLocationalist, Color c, Vector3 v, 
int order) {
   426                 Atom = (GameObject)GameObject.Instantiate(Resources.Load(
"CubeHBPrefab"));
   428                 Atom = (GameObject)GameObject.Instantiate(Resources.Load(
"CubeCubePrefab"));
   430             Atom.SetActive(
true);
   442             float[]  fLocation=atomLocationalist[iAtom] as 
float[];
   443             Vector3 location=
new Vector3(fLocation[0],fLocation[1],fLocation[2]);
   445             Atom.transform.Translate(location);
   446             Atom.GetComponent<Renderer>().material.SetColor(
"_Color",c);
   447             Atom.transform.parent = AtomCubeParent.transform;
   456                 comp.
rayon=(float)(v[0]);
   459                 comp.
z=(float)(fLocation[2]);
   484                 comp1.
rayon = (float)(v[0])*2;
   500                         rayonfactor=1.0f;
break;
   504                 comp1.enabled = 
true;       
   508                 case 0:Atom.tag=
"C";
break;
   509                 case 1:Atom.tag=
"N";
break;
   510                 case 2:Atom.tag=
"O";
break;
   511                 case 3:Atom.tag=
"S";
break;
   512                 case 4:Atom.tag=
"P";
break;
   513                 case 5:Atom.tag=
"H";
break;
   514                 default:Atom.tag=
"X";
break;
   517                 Atom.GetComponent<Renderer>().enabled = 
false;
   519             BoxCollider collider = Atom.GetComponent<Collider>() as BoxCollider;
   520             float newSize = script.
rayon * 60 / 100;
   521             collider.size = 
new Vector3(newSize,newSize,newSize);
   526             link.
index = (int)fLocation[3];
   529         private void CreateAtomRC(
int type, 
int start, 
int end, ArrayList atomLocationalist, Color c, Vector3 v, 
int order) {       
   531             Atom=GameObject.CreatePrimitive(PrimitiveType.Cube);
   532             Atom.transform.parent = AtomCubeParent.transform;
   533             float[]  fLocation=atomLocationalist[start] as 
float[];
   534             Vector3 location=
new Vector3(fLocation[0],fLocation[1],fLocation[2]);
   535             Atom.transform.Translate(location);
   536             Atom.GetComponent<Renderer>().material.SetColor(
"_Color",c);
   538             Atom.GetComponent<Renderer>().material.shader=Shader.Find(
"FvNano/HyperBalls GL_D3D");
   541             comp.
rayon=(float)(v[0]);
   546                 case 0:Atom.tag=
"C";
break;
   547                 case 1:Atom.tag=
"N";
break;
   548                 case 2:Atom.tag=
"O";
break;
   549                 case 3:Atom.tag=
"S";
break;
   550                 case 4:Atom.tag=
"P";
break;
   551                 case 5:Atom.tag=
"H";
break;
   552                 default:Atom.tag=
"X";
break;
   558             link.
index = (int)fLocation[3];
   561         private void CreateAtomRCBB(
int type,
int start ,
int end,ArrayList atomLocationalist,Color c,Vector3 v,
int order) {      
   566                 Atom=GameObject.CreatePrimitive(PrimitiveType.Plane);
   568             float[]  fLocation=atomLocationalist[start] as 
float[];
   569             Vector3 location=
new Vector3(fLocation[0],fLocation[1],fLocation[2]);
   571             Atom.transform.Translate(location);
   572             Atom.GetComponent<Renderer>().material.SetColor(
"_Color",c);
   576             Atom.transform.GetComponent<Renderer>().material.shader=Shader.Find(
"FvNano/HyperBalls GL_D3D");
   579             comp.
rayon=(float)(v[0]);
   584                 case 0:Atom.tag=
"C";
break;
   585                 case 1:Atom.tag=
"N";
break;
   586                 case 2:Atom.tag=
"O";
break;
   587                 case 3:Atom.tag=
"S";
break;
   588                 case 4:Atom.tag=
"P";
break;
   589                 case 5:Atom.tag=
"H";
break;
   590                 default:Atom.tag=
"X";
break; 
   596             link.
index = (int)fLocation[3];
   599         private void CreateAtomHBBB(
int type,
int start ,
int end,ArrayList atomLocationalist,Color c,Vector3 v,
int order) {      
   604                 Atom=GameObject.CreatePrimitive(PrimitiveType.Plane);
   606             float[]  fLocation=atomLocationalist[start] as 
float[];
   607             Vector3 location=
new Vector3(fLocation[0],fLocation[1],fLocation[2]);
   609             Atom.transform.Translate(location);
   610             Atom.GetComponent<Renderer>().material.SetColor(
"_Color",c);
   614             Atom.transform.GetComponent<Renderer>().material.shader=Shader.Find(
"FvNano/HyperBalls GL_D3D");
   617             comp.
rayon=(float)(v[0]);
   624                 case 0:Atom.tag=
"C";
break;
   625                 case 1:Atom.tag=
"N";
break;
   626                 case 2:Atom.tag=
"O";
break;
   627                 case 3:Atom.tag=
"S";
break;
   628                 case 4:Atom.tag=
"P";
break;
   629                 case 5:Atom.tag=
"H";
break;
   630                 default:Atom.tag=
"X";
break;
   636             link.
index = (int)fLocation[3];
   639         private void CreateAtomRCSprite(
int type,
int start ,
int end,ArrayList atomLocationalist,Color c,Vector3 v,
int order) {      
   642             if(!GameObject.Find(
"SpriteManager")) {
   643                 SpriteManager=
new GameObject();
   644                 SpriteManager.name=
"SpriteManager";
   647                 SpriteManager=GameObject.Find(
"SpriteManager");
   649             SpriteManager.GetComponent <MeshRenderer>().enabled=
true;
   654                 Material mat = Resources.Load(
"Materials/hyperballshader", typeof(Material)) as Material;               
   661                 linkedSpriteManager.enabled=
true;
   664             float[]  fLocation=atomLocationalist[start] as 
float[];
   665             Vector3 location=
new Vector3(fLocation[0],fLocation[1],fLocation[2]);
   667             o=MonoBehaviour.Instantiate(Resources.Load(
"HBspriteplane"),location,
new Quaternion(0f,0f,0f,0f));      
   670             Atom.GetComponent<Renderer>().material.SetColor(
"_Color",c);
   672             comp.
rayon=(float)(v[0]);
   676             linkedSpriteManager.
AddSprite(Atom, 1f, 1f, 0, 0, 256, 256, 
true);  
   678                 case 0:Atom.tag=
"C";
break;
   679                 case 1:Atom.tag=
"N";
break;
   680                 case 2:Atom.tag=
"O";
break;
   681                 case 3:Atom.tag=
"S";
break;
   682                 case 4:Atom.tag=
"P";
break;
   683                 case 5:Atom.tag=
"H";
break;
   684                 default:Atom.tag=
"X";
break;
   690             link.
index = (int)fLocation[3];
   693         private void CreateAtomMtHyperBall(
int type,
int start ,
int end,ArrayList atomLocationalist,Color c,Vector3 v,
int order) {       
   695             if(!GameObject.Find(
"MultiHBCube")) {
   696                 Atom=GameObject.CreatePrimitive(PrimitiveType.Cube);
   697                 Atom.name=
"MultiHBCube";
   698                 Atom.transform.parent = AtomCubeParent.transform;
   701                 Atom=GameObject.Find(
"MultiHBCube");
   702             float[]  fLocation=atomLocationalist[start] as 
float[];
   703             Vector3 location=
new Vector3(fLocation[0],fLocation[1],fLocation[2]);
   704             Material newMat = 
new Material(Shader.Find(
"FvNano/HyperBalls GL_D3D"));
   705             newMat.SetVector(
"_TexPos",location);
   706             newMat.SetFloat(
"_Rayon",(
float)(v[0])*0.1f);
   707             newMat.SetColor(
"_Color",c);
   709             ArrayList materialArray= 
new ArrayList(Atom.transform.GetComponent<Renderer>().materials);
   710             materialArray.Add(newMat);
   711             Material[] array = 
new Material[materialArray.Count];
   712             materialArray.CopyTo( array );
   713             Atom.transform.GetComponent<Renderer>().materials = array;  
   715                 case 0:Atom.tag=
"C";
break;
   716                 case 1:Atom.tag=
"N";
break;
   717                 case 2:Atom.tag=
"O";
break;
   718                 case 3:Atom.tag=
"S";
break;
   719                 case 4:Atom.tag=
"P";
break;
   720                 case 5:Atom.tag=
"H";
break;
   721                 default:Atom.tag=
"X";
break;     
   726             link.
index = (int)fLocation[3];
   731             if(!GameObject.Find(
"SpriteManager")) {
   732                 SpriteManager=GameObject.CreatePrimitive(PrimitiveType.Cube);
   733                 SpriteManager.name=
"SpriteManager";
   736                 SpriteManager=GameObject.Find(
"SpriteManager");
   742                 Atom=GameObject.CreatePrimitive(PrimitiveType.Plane);
   744             Atom.transform.parent=SpriteManager.transform;
   745             float[]  fLocation=atomLocationalist[start] as 
float[];
   746             Vector3 location=
new Vector3(fLocation[0],fLocation[1],fLocation[2]);
   747             Atom.transform.Translate(location);
   748             Atom.GetComponent<Renderer>().material.SetColor(
"_Color",c);
   752             Atom.transform.GetComponent<Renderer>().material.shader=Shader.Find(
"FvNano/HyperBalls GL_D3D");
   755             comp.
rayon=(float)(v[0]);
   760                 case 0:Atom.tag=
"C";
break;
   761                 case 1:Atom.tag=
"N";
break;
   762                 case 2:Atom.tag=
"O";
break;
   763                 case 3:Atom.tag=
"S";
break;
   764                 case 4:Atom.tag=
"P";
break;
   765                 case 5:Atom.tag=
"H";
break;
   766                 default:Atom.tag=
"X";
break; 
   771             link.
index = (int)fLocation[3];
 static List< string[]> CSColorList
static float unknownScale
virtual void SetRayonFactor(float rf)
override void Init()
Initalizes this instance. 
static ColorObject phosphorusColor
static bool secondarystruct
Switch between all atoms and C-alpha trace or BFactor secondary structure representation. 
static ColorObject carbonColor
Sprite AddSprite(GameObject client, float width, float height, int leftPixelX, int bottomPixelY, int pixelWidth, int pixelHeight, bool billboarded)
void DisplayAtomCube(ArrayList atomsLocation, int iType)
static ArrayList atomOrderList
ArrayList AtomListByAxisOrder(IList alist)
override void Init()
Initializes this instance of the manager. 
void DisplayAtomMethodByCube()
void DisplayAtoms(UIData.AtomType type_atom, bool force_display=false)
void CreateAtomHBBB(int type, int start, int end, ArrayList atomLocationalist, Color c, Vector3 v, int order)
void CreateAtomRCSprite(int type, int start, int end, ArrayList atomLocationalist, Color c, Vector3 v, int order)
static List< AtomModel > atomsTypelist
The type of each atom. 
void CreateAtomMtHyperBall(int type, int start, int end, ArrayList atomLocationalist, Color c, Vector3 v, int order)
static float phosphorusScale
static Color HexToColor(string hexColor)
static List< float[]> CSRadiusList
static ColorObject nitrogenColor
static float sulphurScale
static ColorObject hydrogenColor
static ColorObject oxygenColor
void CreateCombineMeshHyperBall(int type, int start, int end, ArrayList atomLocationalist, Color c, Vector3 v, int order)
GameObject CreateAtomHB(int iAtom, IList coordinates, IList atomModels)
static List< float[]> CaSplineList
The coordinates of each Carbon alpha in the CA-Spline. 
static ArrayList atomOrderListArray
!WiP Includes FLAGS of GUI. 
static bool isParticlesInitialized
!WiP manage GUI, and provide static strings for the GUI. 
static string file_extension
void CreateAtomRCBB(int type, int start, int end, ArrayList atomLocationalist, Color c, Vector3 v, int order)
static float hydrogenScale
void CreateAtomRC(int type, int start, int end, ArrayList atomLocationalist, Color c, Vector3 v, int order)
static ColorObject unknownColor
static GameObject CreateClip()
void DisplayAtomCube(IList coordinates, IList atomModels)
override void Init()
Initalizes this instance. 
static ColorObject sulphurColor
static bool isHBallLoaded
static GameObject[] cubeGameObjects
static float nitrogenScale
void CreateAtomHB(int iType, int iAtom, ArrayList atomLocationalist, Color c, Vector3 v, int order)
static List< AtomModel > CaSplineTypeList
Type of each carbon alpha in the CA-Spline. 
static List< float[]> atomsLocationlist
The coordinates of each atom.