예제 #1
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);
        }
예제 #2
0
        public static void ToParticle()           // Actually buggy with hyperstick since they don't use "enable/disable renderer" but are destroyed and recreated
        {
            if (UIData.atomtype != UIData.AtomType.particleball)
            {
                UIData.atomtype         = UIData.AtomType.particleball;
                UIData.bondtype         = UIData.BondType.nobond;
                UIData.resetBondDisplay = true;
                UIData.resetDisplay     = true;
                UIData.isCubeToSphere   = false;
                UIData.isSphereToCube   = true;

//				ParticleEffect.radiusFactor = GUIMoleculeController.rayon;
                ShurikenParticleManager.radiusFactor = BallUpdate.radiusFactor;
                GameObject npmObject = GameObject.FindGameObjectWithTag("ShurikenParticleManager");
                ShurikenParticleManager shManager = npmObject.GetComponent <ShurikenParticleManager>();
                shManager.enabled = true;
                shManager.pSystem.GetComponent <Renderer>().enabled = true;

                Debug.Log("ToParticle()");
            }
        }
예제 #3
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());
            }
        }
예제 #4
0
        private void DisplayAtomMethodByCube()
        {
//			ArrayList atomListByType;
            if (atomtype == UIData.AtomType.particleball)
            {
                ArrayList atomListByAxisOrder;
                ArrayList atomListByType;

                if (UIData.secondarystruct)
                {
                    atomListByType = AtomListByType(MoleculeModel.CaSplineList, MoleculeModel.CaSplineTypeList);
                }
                else
                {
                    atomListByType = AtomListByType(MoleculeModel.atomsLocationlist, MoleculeModel.atomsTypelist);
                }

                for (int iType = 0; iType < atomListByType.Count; iType++)
                {
                    DisplayAtomCube(atomListByType[iType] as ArrayList, iType);
                }

                if (UIData.secondarystruct)
                {
                    atomListByAxisOrder = AtomListByAxisOrder(MoleculeModel.CaSplineList);
                }
                else
                {
                    atomListByAxisOrder = AtomListByAxisOrder(MoleculeModel.atomsLocationlist);
                }

                DisplayAtomParticle(atomListByAxisOrder);
            }
            else if (atomtype == UIData.AtomType.particleballalphablend)
            {
                ArrayList atomListByAxisOrder;
                if (UIData.secondarystruct)
                {
                    AtomListByType(MoleculeModel.CaSplineList, MoleculeModel.CaSplineTypeList);
                    atomListByAxisOrder = AtomListByAxisOrder(MoleculeModel.CaSplineList);
                }
                else
                {
                    AtomListByType(MoleculeModel.atomsLocationlist, MoleculeModel.atomsTypelist);
                    atomListByAxisOrder = AtomListByAxisOrder(MoleculeModel.atomsLocationlist);
                }
                DisplayAtomParticle(atomListByAxisOrder);
            }
            else
            {
                if (UIData.secondarystruct)
                {
                    DisplayAtomCube(MoleculeModel.CaSplineList, MoleculeModel.CaSplineTypeList);
                }
                else
                {
                    DisplayAtomCube(MoleculeModel.atomsLocationlist, MoleculeModel.atomsTypelist);
                }
            }

            if (UIData.secondarystruct)
            {
                MoleculeModel.atomsnumber = MoleculeModel.CaSplineList.Count;
            }
            else
            {
                MoleculeModel.atomsnumber = MoleculeModel.atomsLocationlist.Count;
            }

            if (atomtype == UIData.AtomType.combinemeshball)
            {
                GameObject  SpriteManager = GameObject.Find("SpriteManager");
                Meshcombine combineComp   = SpriteManager.GetComponent <Meshcombine>();
                combineComp.GoOn();
            }
            else if (atomtype == UIData.AtomType.particleball || atomtype == UIData.AtomType.particleballalphablend)
            {
                Debug.Log("This is the particle system we actually use.");
                GameObject shurikenParticleManagerObj = GameObject.FindGameObjectWithTag("ShurikenParticleManager");
                ShurikenParticleManager shManager     = shurikenParticleManagerObj.GetComponent <ShurikenParticleManager>();
                shManager.Init();
            }
        }