Exemplo n.º 1
0
        private IEnumerator FillBar()
        {
            // When the bar starts to fill, reset the timer.
            m_Timer = 0f;

            // The amount of time it takes to fill is either the duration set in the inspector, or the duration of the radial.
            float fillTime = m_SelectionRadial != null ? m_SelectionRadial.SelectionDuration : m_Duration;

            // Until the timer is greater than the fill time...
            while (m_Timer < fillTime)
            {
                // ... add to the timer the difference between frames.
                m_Timer += Time.deltaTime;

                // Set the value of the slider or the UV based on the normalised time.
                SetSliderValue(m_Timer / fillTime);

                // Wait until next frame.
                yield return(null);

                // If the user is still looking at the bar, go on to the next iteration of the loop.
                if (m_GazeOver)
                {
                    continue;
                }

                // If the user is no longer looking at the bar, reset the timer and bar and leave the function.
                m_Timer = 0f;
                SetSliderValue(0f);
                yield break;
            }

            // If the loop has finished the bar is now full.
            m_BarFilled = true;
            if (gameObject.name == "Jury")
            {
                api.SendText();
            }
            else
            {
                api.StartNativeRecognition();
            }
            // Play the clip for when the bar is filled.
            // If anything has subscribed to OnBarFilled call it now.
            if (OnBarFilled != null)
            {
                OnBarFilled();
            }
            m_Audio.clip = m_OnFilledClip;
            m_Audio.Play();



            // If the bar should be disabled once it is filled, do so now.
            //if (m_DisableOnBarFill)
            //enabled = false;
        }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        // Si recibimos alguno toque en pantalla, entonces llamamos al reconocimiento de voz
        if (Input.touchCount == 1)
        {
            if (Input.GetTouch(0).phase == TouchPhase.Began)
            {
                ai_module.StartNativeRecognition();
            }
        }

        Vector3    pos = cam.transform.position;
        RaycastHit hit;

        //lanzamos un rayo desde la cámara hacia delante y si golpeamos algún objeto con un el rayo nos devuelve true
        if (Physics.Raycast(pos, cam.transform.forward, out hit, 10000))
        {
            //Si el nombre del objeto golpeado es ScrollUp o ScrollDown, entonces hacemos scroll hacia arriba o hacia abajo
            if (hit.transform.name == "ScrollUp")
            {
                full_sum = myScrollRect.verticalNormalizedPosition + 0.002f;
                if (full_sum > 1.0f)
                {
                    full_sum = 1.0f;
                }
            }
            else if (hit.transform.name == "ScrollDown")
            {
                full_sum = myScrollRect.verticalNormalizedPosition - 0.002f;
                if (full_sum < 0.0f)
                {
                    full_sum = 0.0f;
                }
            }
            myScrollRect.verticalNormalizedPosition = full_sum;
        }
    }