コード例 #1
0
ファイル: Stage5.cs プロジェクト: connor-roche/Launch-into-VR
    // Update is called once per frame
    void Update()
    {
        // See if they are pointing at the ball and pressing any button other than the main trigger

        if (m_RaycasterScript.GetTarget() != null)
        {
            if (m_RaycasterScript.GetTarget().tag.Contains("_PickUp_") &&
                OVRInput.GetDown(OVRInput.Button.Any) &&
                !OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger) &&
                !m_RaycasterScript.m_HoldingObject)
            {
                IntroSessionManager.s_Instance.Toast("Hold the trigger button down to hold the ball...", IntroSessionManager.c_TOAST_LONG);
            }

            // See if they are clicking on random things that arn't the ball
            if (!m_RaycasterScript.GetTarget().tag.Contains("_PickUp_") &&
                OVRInput.GetDown(OVRInput.Button.Any) &&
                !m_RaycasterScript.m_HoldingObject)
            {
                IntroSessionManager.s_Instance.Toast("You're clicking on the wrong object, try pointing at the ball...", IntroSessionManager.c_TOAST_LONG);
            }
        }

        if (m_BallDroppedCount % 3 == 0 && m_BallDroppedCount != 0)
        {
            IntroSessionManager.s_Instance.Toast("Be sure to hold the the trigger down to keep the ball held...", IntroSessionManager.c_TOAST_LONG);
        }
    }
コード例 #2
0
ファイル: Stage4.cs プロジェクト: connor-roche/Launch-into-VR
    // Update is called once per frame
    void Update()
    {
        m_timer += Time.deltaTime;          // Increment the timer

        if (m_RaycasterScript.GetTarget() != null)
        {
            // See if they are pointing at the ball and pressing any button other than the main trigger
            if (m_RaycasterScript.GetTarget().tag.Contains("_PickUp_") && OVRInput.GetDown(OVRInput.Button.Any) &&
                !OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger) && !m_RaycasterScript.m_HoldingObject)
            {
                IntroSessionManager.s_Instance.Toast("Hold the trigger button down to hold the ball...", IntroSessionManager.c_TOAST_LONG);
            }

            // See if they are clicking on random things that arn't the ball
            if (!m_RaycasterScript.GetTarget().tag.Contains("_PickUp_") && OVRInput.GetDown(OVRInput.Button.Any) &&
                !m_RaycasterScript.m_HoldingObject)
            {
                IntroSessionManager.s_Instance.Toast("You're clicking on the wrong object, try pointing at the ball...", IntroSessionManager.c_TOAST_LONG);
            }
        }

        // If they are having trouble holding the ball then give them a tip
        if (m_ballDroppedCount % 3 == 0 && m_timer > 10f)
        {
            IntroSessionManager.s_Instance.Toast("Be sure to hold the the trigger down to keep the ball held...", IntroSessionManager.c_TOAST_LONG);
            m_timer = 0;                // reset the timer
        }
    }
コード例 #3
0
ファイル: Stage3.cs プロジェクト: connor-roche/Launch-into-VR
    // Update is called once per frame
    void Update()
    {
        // if the user is not pressing the trigger, highlight it so they know which one to press
        if (!OVRInput.Get(OVRInput.Button.PrimaryIndexTrigger))
        {
            m_Manager.HighlightButtonOn(m_Manager.GetTriggerButton());
        }

        // See if they are pointing at the ball and pressing any button other than the main trigger
        if (m_RaycasterScript.GetTarget() != null)
        {
            if (m_RaycasterScript.GetTarget().tag.Contains("_Stage3Button_") &&
                OVRInput.GetDown(OVRInput.Button.Any) &&
                !OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger))
            {
                IntroSessionManager.s_Instance.Toast("Be sure your clicking the trigger button...", IntroSessionManager.c_TOAST_LONG);
            }

            // See if they are clicking on random things that arn't the ball
            if (!m_RaycasterScript.GetTarget().tag.Contains("_Stage3Button_") && OVRInput.GetDown(OVRInput.Button.Any))
            {
                IntroSessionManager.s_Instance.Toast("You're clicking on the wrong object, try pointing at the button...", IntroSessionManager.c_TOAST_LONG);
            }
        }
    }
コード例 #4
0
ファイル: Stage1.cs プロジェクト: connor-roche/Launch-into-VR
    // 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