Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        if (detectCameraCollision())
        {
            this.transform.position    = Arthroscope.initialPosition;
            this.transform.eulerAngles = Arthroscope.initialRotation;
            Arthroscope.changeCameraRotation(90.0f);

            this.rigidbody.constraints = RigidbodyConstraints.FreezeAll;

            StartCoroutine(DenyArthroscopeMovementAndSetInitialPosition());
            StartCoroutine(blink());

            PortalsMenu.rebootControls2D();
        }
    }
Beispiel #2
0
    /* Menu de resultados  */
    void OnGUI()
    {
        Texture2D botonOriginal = new GUIStyle("button").normal.background;

        if (MainLayout.arthroscope)
        {
            GUI.depth = 3;
            float distance    = 2.2f;
            float LSeparation = 0.3f;
            float BSeparation = 0.4f;

            if (portalsSkin)
            {
                GUI.skin = portalsSkin;
            }

            GUI.Box(new Rect(WIDTH_MENU, HEIGHT_MENU, WIDTH * 0.8f, HEIGHT), "Artroscopio.");

            GUI.skin.label.fontSize = (int)(Math.Round((double)WIDTH_MENU * 0.7f, 0));

            /*
             * Angle's labels
             */
            GUI.Label(new Rect(WIDTH_MENU * 3.5f, HEIGHT_MENU * 1.5f, WIDTH, HEIGHT_BUTTON), "Angulos ");

            /*
             * 0 degrees button
             */
            if (
                GUI.Button(new Rect(WIDTH_MENU * 1.1f,
                                    HEIGHT_MENU * 1.8f,
                                    WIDTH_BUTTON * 0.7f,
                                    HEIGHT_BUTTON * 0.7f), "0°")
                )
            {
                Arthroscope.changeCameraRotation(90.0f);
            }

            /*
             * 30 degrees button
             */
            if (
                GUI.Button(new Rect(WIDTH_MENU + WIDTH_BUTTON * 0.7f + 10.0f,
                                    HEIGHT_MENU * 1.8f,
                                    WIDTH_BUTTON * 0.7f,
                                    HEIGHT_BUTTON * 0.7f), "30°")
                )
            {
                Arthroscope.changeCameraRotation(120.0f);
            }

            /*
             * 70 degrees button
             */
            if (
                GUI.Button(new Rect(WIDTH_MENU + ((WIDTH_BUTTON * 0.7f) * 2.0f) + 20.0f,
                                    HEIGHT_MENU * 1.8f,
                                    WIDTH_BUTTON * 0.7f,
                                    HEIGHT_BUTTON * 0.7f), "70°")
                )
            {
                Arthroscope.changeCameraRotation(160.0f);
            }

            /*
             * End angle's labels
             */

            /*
             * Portals
             */

            /*
             * Portal's label
             */
            GUI.Label(new Rect(WIDTH_MENU * 3.5f, HEIGHT_MENU * distance, WIDTH, HEIGHT_BUTTON), "Portales ");

            if (
                GUI.Button(new Rect(WIDTH_MENU * 3.3f,
                                    HEIGHT_MENU * (distance = distance + LSeparation),
                                    WIDTH_BUTTON,
                                    HEIGHT_BUTTON * 0.7f), "Anterocentral")
                )
            {
                moveArthroscopeToPortal(position0, rotation0);
            }

            if (
                GUI.Button(new Rect(WIDTH_MENU * 1.1f,
                                    HEIGHT_MENU * (distance = distance + BSeparation),
                                    WIDTH_BUTTON,
                                    HEIGHT_BUTTON * 0.7f), "Anterolateral")
                )
            {
                moveArthroscopeToPortal(position1, rotation1);
            }

            if (
                GUI.Button(new Rect(WIDTH_MENU * 5.5f,
                                    HEIGHT_MENU * (distance),
                                    WIDTH_BUTTON + offset,
                                    HEIGHT_BUTTON * 0.7f), "Anteromedial")
                )
            {
                moveArthroscopeToPortal(position2, rotation2);
            }

            if (
                GUI.Button(new Rect(WIDTH_MENU * 1.1f,
                                    HEIGHT_MENU * (distance = distance + BSeparation),
                                    WIDTH_BUTTON,
                                    HEIGHT_BUTTON * 0.7f), "Superolateral")
                )
            {
                moveArthroscopeToPortal(position4, rotation4);
            }

            if (
                GUI.Button(new Rect(WIDTH_MENU * 5.5f,
                                    HEIGHT_MENU * (distance),
                                    WIDTH_BUTTON + offset,
                                    HEIGHT_BUTTON * 0.7f), "Superomedial")
                )
            {
                moveArthroscopeToPortal(position3, rotation3);
            }

            if (
                GUI.Button(new Rect(WIDTH_MENU * 1.1f,
                                    HEIGHT_MENU * (distance = distance + BSeparation),
                                    WIDTH_BUTTON,
                                    HEIGHT_BUTTON * 0.7f), "Posterolateral")
                )
            {
                moveArthroscopeToPortal(position5, rotation5);
            }

            if (
                GUI.Button(new Rect(WIDTH_MENU * 5.5f,
                                    HEIGHT_MENU * (distance),
                                    WIDTH_BUTTON + offset,
                                    HEIGHT_BUTTON * 0.7f), "Posteromedial")
                )
            {
                moveArthroscopeToPortal(position6, rotation6);
            }

            /*
             * Continue button
             */
            if (GUI.Button(new Rect(WIDTH * 0.01f + ANCHO_BUTTON + offset,
                                    (HEIGHT + HEIGHT_BUTTON * 1.7f),
                                    WIDTH_BUTTON,
                                    HEIGHT_BUTTON), "Continuar"))
            {
                MainLayout.arthroscope = !MainLayout.arthroscope;
            }
        }
    }