//Create atoms according to type. Particles are created only once except if display is forced
        public void DisplayAtoms(UIData.AtomType type_atom, bool force_display = false)
        {
            if (type_atom != UIData.AtomType.particleball || !UIData.isParticlesInitialized || force_display)
            {
                //if(!UIData.isCubeLoaded){
                if (AtomCubeParent == null)
                {
                    AtomCubeParent = new GameObject("AtomCubeParent");
                }

                if (MoleculeModel.atoms != null)
                {
                    MoleculeModel.atoms.Clear();
                    MoleculeModel.atoms = null;
                }

                MoleculeModel.atoms = new ArrayList();
                Debug.Log("DisplayAtoms :: ***clear MolecularModel**** ");
                atomtype = type_atom;
                DisplayAtomMethodByCube();
                UIData.isParticlesInitialized = true;
                if (UIData.atomtype == UIData.AtomType.cube)
                {
                    UIData.isCubeLoaded = true;
                }
                else if (UIData.atomtype == UIData.AtomType.hyperball)
                {
                    UIData.isHBallLoaded = true;
                }
                //}
            }
        }
Example #2
0
 public void ShowAtoms()
 {
     if (UIData.atomtype == UIData.AtomType.noatom)
     {
         UIData.atomtype   = previous_AtomType;
         previous_AtomType = UIData.AtomType.noatom;
         DisplayMolecule.ShowAtoms();
     }
 }
Example #3
0
 /// <summary>
 /// Switch the protein representation to Hyperball. Used in switch mode (LOD).
 /// </summary>
 public void ToNotParticle()
 {
     if (UIData.atomtype != UIData.AtomType.particleball && UIData.atomtype != previous_AtomType)
     {
         previous_AtomType = UIData.atomtype;
         previous_BondType = UIData.bondtype;
     }
     DisplayMolecule.ToNotParticle(previous_AtomType, previous_BondType);
 }
Example #4
0
 public void HideAtoms()
 {
     if (UIData.atomtype != UIData.AtomType.noatom)
     {
         Debug.Log("Hiding all atoms now.");
         DisplayMolecule.HideAtoms();
         previous_AtomType = UIData.atomtype;
         UIData.atomtype   = UIData.AtomType.noatom;
     }
 }
Example #5
0
 /// <summary>
 /// Switch the protein representation to Particle. Used in switch mode (LOD).
 /// </summary>
 public void ToParticle()
 {
     if (UIData.atomtype != UIData.AtomType.particleball)
     {
         previous_AtomType = UIData.atomtype;
         previous_BondType = UIData.bondtype;
     }
     DisplayMolecule.ToParticle();
     // Debug.Log("ToParticle()");
 }
Example #6
0
        /// <summary>
        /// Gets the list of active managers based on the atom type provided and based on the bond type in UIData.
        /// </summary>
        /// <returns>
        /// The list of managers. A List<GenericManager> object that should contains the "atom" manager in position 0 and the "bond" manager in position 1 (if there is one).
        /// </returns>
        public static List <GenericManager> GetManagers()
        {
            UIData.AtomType       aType       = UIData.atomtype;
            List <GenericManager> managerList = new List <GenericManager>();

            if (aType == UIData.AtomType.hyperball)               //||  UIData.bondtype == UIData.BondType.hyperstick) {
            {
                GameObject   hbManagerObj = GameObject.FindGameObjectWithTag("HBallManager");
                HBallManager hbManager    = hbManagerObj.GetComponent <HBallManager>();
                managerList.Add(hbManager);
            }
            else if (aType == UIData.AtomType.sphere)
            {
                GameObject    spManagerObj = GameObject.FindGameObjectWithTag("SphereManager");
                SphereManager spManager    = spManagerObj.GetComponent <SphereManager>();
                managerList.Add(spManager);
            }
            else if (aType == UIData.AtomType.cube)
            {
                GameObject  cubeManagerObj = GameObject.FindGameObjectWithTag("CubeManager");
                CubeManager cubeManager    = cubeManagerObj.GetComponent <CubeManager>();
                managerList.Add(cubeManager);
            }
            else if (aType == UIData.AtomType.particleball)
            {
                GameObject psObj = GameObject.FindGameObjectWithTag("ShurikenParticleManager");
                ShurikenParticleManager shManager = psObj.GetComponent <ShurikenParticleManager>();
                managerList.Add(shManager);
            }
            if (UIData.bondtype == UIData.BondType.line)
            {
                GameObject  lineManagerObj = GameObject.FindGameObjectWithTag("LineManager");
                LineManager lineManager    = lineManagerObj.GetComponent <LineManager>();
                managerList.Add(lineManager);
            }
            else if (UIData.bondtype == UIData.BondType.cube)
            {
                GameObject      cubeBondManagerObj = GameObject.FindGameObjectWithTag("CubeBondManager");
                CubeBondManager cubeBondManager    = cubeBondManagerObj.GetComponent <CubeBondManager>();
                managerList.Add(cubeBondManager);
            }
            else if (UIData.bondtype == UIData.BondType.hyperstick)
            {
                GameObject    hStickManagerObj = GameObject.FindGameObjectWithTag("HStickManager");
                HStickManager hStickManager    = hStickManagerObj.GetComponent <HStickManager>();
                managerList.Add(hStickManager);
            }
            return(managerList);
        }
Example #7
0
        public static void ToNotParticle(UIData.AtomType previousType, UIData.BondType previousBondType)
        {
            if (previousType != UIData.AtomType.noatom && UIData.atomtype != previousType)
            {
                GameObject shObject = GameObject.FindGameObjectWithTag("ShurikenParticleManager");
                ShurikenParticleManager shManager = shObject.GetComponent <ShurikenParticleManager>();
                shManager.pSystem.GetComponent <Renderer>().enabled = false;
                shManager.enabled = false;

                UIData.atomtype         = previousType;
                UIData.bondtype         = previousBondType;
                UIData.resetBondDisplay = true;
                UIData.resetDisplay     = true;
                if (UIData.atomtype == UIData.AtomType.sphere)
                {
                    UIData.isCubeToSphere = true;
                    UIData.isSphereToCube = false;
                }
                else
                {
                    UIData.isCubeToSphere = false;
                    UIData.isSphereToCube = true;
                }

                if (UIData.atomtype == UIData.AtomType.hyperball)
                {
                    GameObject   hbmObject = GameObject.FindGameObjectWithTag("HBallManager");
                    HBallManager hbManager = hbmObject.GetComponent <HBallManager>();
                    BallUpdate.resetRadii = true;
                    hbManager.EnableRenderers();
                    hbManager.enabled = true;
                }

                Debug.Log("ToHyperBall()");
                Debug.Log(UIData.atomtype.ToString());
                Debug.Log(UIData.bondtype.ToString());
            }
        }
        public void DisplayAtoms(UIData.AtomType type_atom, bool force_display = false)
        {
            if (type_atom != UIData.AtomType.particleball || !UIData.isParticlesInitialized || force_display)
            {
                //if(!UIData.isSphereLoaded){
                if (AtomCubeParent == null)
                {
                    AtomCubeParent = new GameObject("AtomCubeParent");
                }

                if (MoleculeModel.atoms != null)
                {
                    MoleculeModel.atoms.Clear();
                    MoleculeModel.atoms = null;
                }
                MoleculeModel.atoms = new ArrayList();

                atomtype = type_atom;

                if (atomtype == UIData.AtomType.sphere)
                {
                    if (UIData.secondarystruct)
                    {
                        DisplayAtomMethodBySphere(MoleculeModel.CaSplineList, MoleculeModel.CaSplineTypeList);
                    }
                    else
                    {
                        DisplayAtomMethodBySphere(MoleculeModel.atomsLocationlist, MoleculeModel.atomsTypelist);
                    }
                }
                GameObject    sphereManagerObj = GameObject.FindGameObjectWithTag("SphereManager");
                SphereManager sphereManager    = sphereManagerObj.GetComponent <SphereManager>();
                sphereManager.Init();
                UIData.isSphereLoaded = true;
                //}
            }
        }