protected virtual void Start()
 {
     m_TrackerInput = TrackerInput.Find(null);
     if (m_FPSCounter != null)
     {
         m_FPSCounter.getFrameCount = GetFrameCount;
     }
 }
예제 #2
0
    protected virtual void Start()
    {
        // Add an UIFade forcefully for a better user experience.
        if (useFade)
        {
            // Override user settings.
            if (VRContext.main != null)
            {
                m_UIFade            = VRContext.main.fadeFx;
                m_UIFade.durationIn = m_UIFade.durationIn = fadeTime;
                m_UIFade.GetComponent <Image>().color = fadeColor;
                //
                m_UIFade.alpha = 1.0f;
                m_UIFade.FadeOut();
            }
        }
        // <!-- TODO: VR Legacy Mode. -->
        TrackerInput trackerInput = TrackerInput.Find(null);

        if (trackerInput == null || trackerInput.connectionState != DeviceConnectionState.Connected)
        {
            OnFinished();
            //
        }
        else
        {
            trackerInput.onRecenter += () => {
                onRecenter.Invoke();
                if (tipRecenter != null)
                {
                    tipRecenter.FadeOut();
                }
                else
                {
                    fistsToStartSettings.onStart();
                }
            };
        }
    }
예제 #3
0
        public virtual void Update()
        {
            int num = 0;

            for (int i = 0, imax = m_Fists.Length; i < imax; ++i)
            {
                if (children[i] != null && m_Fists[i] != null)
                {
                    if ((m_Fists[i].position - children[i].position).sqrMagnitude <= childSize * childSize)
                    {
                        ++num;
                        // Invoke events.
                        if (!m_ChildIsReady[i])
                        {
                            // Trigger a vibration to notify users this controller is ready.
                            ControllerInput input = ControllerInputManager.instance.GetControllerInput(ControllerType.LeftController + i);
                            if (input != null)
                            {
                                input.StartVibration(0, 0.25f);
                            }
                            /*...*/
                            if (m_ChildReadyObjects[i] != null)
                            {
                                if (string.IsNullOrEmpty(childReadyMsg))
                                {
                                    m_ChildReadyObjects[i].SetActive(true);
                                }
                                else
                                {
                                    m_ChildReadyObjects[i].SendMessage(childReadyMsg, true, SendMessageOptions.DontRequireReceiver);
                                }
                            }
                        }
                        //
                        m_ChildIsReady[i] = true;
                    }
                    else
                    {
                        // Invoke events.
                        if (m_ChildIsReady[i])
                        {
                            /*...*/
                            if (m_ChildReadyObjects[i] != null)
                            {
                                if (string.IsNullOrEmpty(childReadyMsg))
                                {
                                    m_ChildReadyObjects[i].SetActive(false);
                                }
                                else
                                {
                                    m_ChildReadyObjects[i].SendMessage(childReadyMsg, false, SendMessageOptions.DontRequireReceiver);
                                }
                            }
                        }
                        //
                        m_ChildIsReady[i] = false;
                    }
                }
            }
            if (num == m_Fists.Length || buttonSkip.GetAny())
            {
                // TODO:
                TrackerInput trackerInput = TrackerInput.Find(null);
                if (trackerInput != null)
                {
                    trackerInput.Recenter();
                }
                //
                StopListen();
                if (onStart != null)
                {
                    onStart();
                }
            }
        }