// 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