Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (!m_IsStageComplete && i_CurrentArrow > 3)
        {
            // User looked at all 4 arrows for the first time
            m_RaycasterScript.m_OverrideDefaultReticleControls = false;      // give control of the reticle back
            m_Manager.MoveToNextStage(2f);
            m_IsStageComplete = true;
        }

        m_Target = m_RaycasterScript.GetTarget();      // Gets the object that the user is looking at
        if (m_Target != null && !m_IsStageComplete)
        {
            if (m_Target.tag.Contains("Arrow"))
            {
                // User is looking at an arrow
                m_WasLookingAtArrow = true;

                if (Array.IndexOf(m_ArrowsObjectList, m_Target.transform.parent.gameObject) < i_CurrentArrow)
                {
                    // User already looked at this arrow
                    m_LoadingBar.fillAmount = 1f;
                    m_LookingAtCompleted    = true;
                }
                else
                {
                    m_LookingAtCompleted = false;
                    LoadProgressBar();
                }
            }
            else if (m_WasLookingAtArrow)
            {
                // The user was looking at an arrow and looked away
                ResetProgressBar();
            }

            if (m_LoadingBar.fillAmount == 1 && !m_LookingAtCompleted)
            {
                // 100% loaded
                if (m_Target.tag.Contains(m_ArrowsList[i_CurrentArrow]))
                {
                    // User is looking at the correct arrow
                    RegisterArrow();
                }
                else
                {
                    // User was looking at the wrong arrow
                    m_Manager.ReticleInvalidOperation();
                }
            }
        }
        else if (m_WasLookingAtArrow)
        {
            // The user was looking at an arrow and looked away
            ResetProgressBar();
        }
    } // end update
Ejemplo n.º 2
0
    /// <summary>
    /// This gets called when the user clicks the button
    /// </summary>
    private void ButtonWasClicked()
    {
        if (m_CanHitButton)
        {
            m_CanHitButton = false;

            // End the stage
            m_Manager.HighlightButtonOff(m_Manager.GetTriggerButton());
            m_Manager.MoveBoxOutOfScene();
            m_Manager.MoveToNextStage(2f);
        }
    }
Ejemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        // Check if the user has their controller connected
        if (OVRInput.IsControllerConnected(OVRInput.Controller.RTrackedRemote) || OVRInput.IsControllerConnected(OVRInput.Controller.LTrackedRemote))
        {
            if (m_IntroNotStarted)
            {
                // Begin the scene
                m_Manager.HighlightButtonOn(m_Manager.GetHomeButton());
                m_Manager.GlobalMessage(m_DialogueInstructions.DialogueElements[0]);
                m_IntroNotStarted = false;
            }
        }
        else
        {
            m_Manager.GlobalMessage("Please connect your controller!");
        }

        //checks if other buttons are pressed for fail point
        if (OVRInput.GetDown(OVRInput.Button.PrimaryTouchpad) || OVRInput.GetDown(OVRInput.Button.Back) || OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger))
        {
            i_ErrorCounter++;
            if (i_ErrorCounter % m_NumberOfTries == 0)
            {
                IntroSessionManager.s_Instance.Toast("Look down at the controller to see what button to press.", IntroSessionManager.c_TOAST_SHORT);
            }
        }

        // Check if the user has recentered correctly
        if (m_CheckRecenter)
        {
            if (OVRInput.GetControllerWasRecentered(OVRInput.Controller.RTrackedRemote) ||
                OVRInput.GetControllerWasRecentered(OVRInput.Controller.LTrackedRemote))
            {
                // End the scene
                m_CheckRecenter = false;
                m_Manager.HighlightButtonOff(m_Manager.GetHomeButton());
                m_Manager.MoveToNextStage(1f);
            }
        }
    }