Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Return) && measurementInput != null)
        {
            EvaluateMeasurement(measurementInput);
            measurementInput.DeactivateInputField();
        }

        if (Input.GetMouseButtonDown(0))
        {
            MagnifyGlass.DisableZoom();
        }

        if (Input.GetMouseButtonDown(1) && !MagnifyGlass.IsZoomable())
        {
            MagnifyGlass.ResetCounter();
            MagnifyGlass.EnableZoom();
        }

        if (TimerScript.GetCurrentTime() <= 0)
        {
            Submit();
        }

        //Might want to make these into coroutines to delay the zoom a bit
        //Linearly interpolates between the default camera view and the zoomed view. Updates each frame for a smoother zoom effect
        if (zoomingIn)
        {
            if (Camera.main.orthographicSize <= zoomedFOV)
            {
                zoomingIn = false;
                Camera.main.orthographicSize = zoomedFOV;
            }
            else
            {
                Camera.main.orthographicSize += Time.deltaTime * -zoomInSpeed;
            }
        }

        if (zoomingOut)
        {
            if (Camera.main.orthographicSize >= defaultFOV)
            {
                zoomingOut = false;
                Camera.main.orthographicSize = defaultFOV;
            }
            else
            {
                Camera.main.orthographicSize += Time.deltaTime * zoomOutSpeed;
            }
        }
    }