Esempio n. 1
0
        //Hypersticks
        private void CreateCylinderByShader(int start)
        {
            GameObject Stick;
            int        i = start;

            int[] atomsIds = bondEPList[i] as int[];
            Stick = GameObject.CreatePrimitive(PrimitiveType.Cube);
            RuntimePlatform platform = Application.platform;

            switch (platform)
            {
            case RuntimePlatform.WindowsPlayer:
            case RuntimePlatform.WindowsWebPlayer:
            case RuntimePlatform.WindowsEditor:
                Stick.renderer.material.shader = Shader.Find("FvNano/Stick HyperBalls 2 OpenGL");
                break;

            default:
                Stick.renderer.material.shader = Shader.Find("FvNano/Stick HyperBalls 2 OpenGL");
                break;
            }
            StickUpdate comp = Stick.AddComponent <StickUpdate>();

            //Debug.Log("BOND : " + atomsIds[0] + " - " + atomsIds[1]);
            //comp.atompointer1=(GameObject)MoleculeModel.atoms[atomsIds[0]];
            //comp.atompointer2=(GameObject)MoleculeModel.atoms[atomsIds[1]];

            if (UI.UIData.atomtype == UI.UIData.AtomType.particleball)
            {
                comp.atompointer1 = (GameObject)MoleculeModel.atoms[atomsIds[0]];
                comp.atompointer2 = (GameObject)MoleculeModel.atoms[atomsIds[1]];
            }
            else
            {
                GenericManager manager = Molecule.View.DisplayMolecule.GetManagers()[0];
                comp.atompointer1 = manager.GetBall(Molecule.Model.MoleculeModel.atoms.Count - 1 - atomsIds[0]);
                comp.atompointer2 = manager.GetBall(Molecule.Model.MoleculeModel.atoms.Count - 1 - atomsIds[1]);
            }

            comp.enabled = true;
            Stick.renderer.material.SetFloat("_Shrink", StickUpdate.shrink);
            Stick.tag = "Club";
            Stick.collider.enabled   = false;
            Stick.transform.position = comp.atompointer1.transform.position;
            Stick.transform.parent   = BondCubeParent.transform;
        }
Esempio n. 2
0
        //Billboard hypersticks
        private void CreateBBCylinderByShader(int i)
        {
            GameObject Stick;

            if (UIData.toggleClip)
            {
                Stick = Clip4HyperStick.CreateClip();
            }
            else
            {
                Stick = GameObject.CreatePrimitive(PrimitiveType.Plane);
            }

            int[] atomsIds = bondEPList[i] as int[];

            Stick.transform.Rotate(new Vector3(0, -180, 0));
            Stick.AddComponent("CameraFacingBillboard");
            Stick.GetComponent <CameraFacingBillboard>().cameraToLookAt = GameObject.Find("Camera").camera;
            RuntimePlatform platform = Application.platform;

            switch (platform)
            {
            case RuntimePlatform.WindowsPlayer:
            case RuntimePlatform.WindowsWebPlayer:
            case RuntimePlatform.WindowsEditor:
                Stick.renderer.material.shader = Shader.Find("FvNano/Stick HyperBalls 2 OpenGL");
                break;

            default:
                Stick.renderer.material.shader = Shader.Find("FvNano/Stick HyperBalls 2 OpenGL");
                break;
            }
            Stick.AddComponent("StickUpdate");

            StickUpdate comp = Stick.GetComponent <StickUpdate>();

            comp.atompointer1 = (GameObject)MoleculeModel.atoms[atomsIds[0]];
            comp.atompointer2 = (GameObject)MoleculeModel.atoms[atomsIds[1]];

            comp.enabled = true;
            Stick.renderer.material.SetFloat("_Shrink", 0.01f);
            Stick.tag = "Club";
            Stick.transform.parent = BondCubeParent.transform;
        }