Exemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 protected virtual void Update()
 {
     //
     if (buttonRecenter.GetAnyDown())
     {
         Recenter(true);
     }
 }
Exemplo n.º 2
0
            public void Process()
            {
                // Save the previous Game Object
                GameObject gazeObjectPrevious = GetCurrentGameObject();

                CastRayFromGaze();
                UpdateCurrentObject();
                UpdateReticle(gazeObjectPrevious);

                // Handle input
                //if(!Input.GetMouseButtonDown(0)&&Input.GetMouseButton(0)) {
                //	HandleDrag();
                //} else if(Time.unscaledTime-pointerData.clickTime<clickTime) {
                //	// Delay new events until clickTime has passed.
                //} else if(!pointerData.eligibleForClick&&
                //		   (GvrViewer.Instance.Triggered||Input.GetMouseButtonDown(0)||
                //			GvrController.ClickButtonDown)) {
                //	// New trigger action.
                //	HandleTrigger();
                //} else if(!GvrViewer.Instance.Triggered&&!Input.GetMouseButton(0)&&
                //		   !GvrController.ClickButton) {
                //	// Check if there is a pending click to handle.
                //	HandlePendingClick();
                //}

                // Handle input
                if (!buttonClick.GetAnyDown() && buttonClick.Get())
                {
                    HandleDrag();
                }
                else if (Time.unscaledTime - pointerData.clickTime < clickTime)
                {
                    // Delay new events until clickTime has passed.
                }
                else if (!pointerData.eligibleForClick &&
                         (buttonClick.GetAnyDown()))
                {
                    // New trigger action.
                    HandleTrigger();
                }
                else if (!buttonClick.Get())
                {
                    // Check if there is a pending click to handle.
                    HandlePendingClick();
                }
            }
Exemplo n.º 3
0
 protected virtual void Update()
 {
     if (buttonRecord.GetAnyDown())
     {
         if (recordState == RecordState.Record)
         {
             recordState = RecordState.Idle;
         }
         else
         {
             recordState = RecordState.Record;
             m_Time      = 0f;
         }
     }
     if (buttonPlay.GetAnyDown())
     {
         if (recordState == RecordState.Play)
         {
             recordState = RecordState.Idle;
         }
         else
         {
             recordState    = RecordState.Play;
             m_Time         = 0f;
             m_FrameStep    = 1;
             m_CurrentFrame = m_NumFrames = 0;
             if (recordObjects.Length > 0)
             {
                 m_NumFrames = recordObjects[0].keyFrames.Count;
             }
         }
     }
     //
     m_Time -= Time.deltaTime;
     if (m_Time <= 0f)
     {
         UpdateRecorder();
         m_Time += m_TimePerFrame;
     }
 }
Exemplo n.º 4
0
 public virtual void TryFixMarkOffset()
 {
     switch (m_TrackedHead.trackingType)
     {
     case TrackedHead.TrackingType.Outside_In:
         // TODO :
         //
         if (m_CalPointIndex_DK4 < 0)
         {
             bool isAllDown = buttonStartFixMark.Length != 0;
             for (int i = 0, imax = buttonStartFixMark.Length; i < imax; ++i)
             {
                 if (!buttonStartFixMark[i].GetAny())
                 {
                     isAllDown = false;
                     break;
                 }
             }
             if (isAllDown)
             {
                 m_CalPointIndex_DK4 = 0;
                 //
                 if (uiRoot != null)
                 {
                     uiRoot.SetActive(true);
                 }
                 if (textFixMark != null)
                 {
                     textFixMark.text = tipsFixMark[m_CalPointIndex_DK4];
                 }
             }
         }
         else if (m_CalPointIndex_DK4 < 4)
         {
             if (buttonNextFixMark.GetAnyDown())
             {
                 m_CalPoints_DK4[m_CalPointIndex_DK4++] = m_TrackedHead.controllerInput.GetPosition();
                 //
                 if (textFixMark != null)
                 {
                     textFixMark.text = tipsFixMark[m_CalPointIndex_DK4];
                 }
             }
             if (buttonCancelFixMark.GetAnyDown())
             {
                 m_CalPointIndex_DK4 = 5;
             }
         }
         else if (m_CalPointIndex_DK4 == 4)
         {
             if (buttonNextFixMark.GetAnyDown())
             {
                 m_CalPointIndex_DK4 = 5;
             }
         }
         // Quit GUI
         if (m_CalPointIndex_DK4 == 5)
         {
             FixMarkOffset_DK4(m_CalPoints_DK4);
             m_CalPointIndex_DK4 = -1;
             //
             if (textFixMark != null)
             {
                 textFixMark.text = "";
             }
             if (uiRoot != null)
             {
                 uiRoot.SetActive(false);
             }
         }
         break;
     }
 }