Ejemplo n.º 1
0
 protected void Start()
 {
     if (provider.IsConnected())
     {
         deviceInfo = provider.GetDeviceInfo();
         _shouldSetLocalPosition = true;
         LeapVRCameraControl.OnValidCameraParams += onValidCameraParams;
     }
     else
     {
         StartCoroutine(waitForConnection());
         Controller controller = provider.GetLeapController();
         controller.Device += OnDevice;
     }
 }
Ejemplo n.º 2
0
        private IEnumerator Monitor()
        {
            yield return(new WaitForSecondsRealtime(monitorInterval)); //Give controller time to connect at startup

            while (true)
            { //forever
                connected = provider.IsConnected();
                if (connected)
                {
                    while (fadedIn > 0.0)
                    {
                        fadedIn -= Time.deltaTime / fadeOutTime;
                        fadedIn  = Mathf.Clamp(fadedIn, 0.0f, 1.0f);
                        SetAlpha(fadeCurve.Evaluate(fadedIn));
                        yield return(null);
                    }
                }
                else
                {
                    while (fadedIn < 1.0)
                    {
                        fadedIn += Time.deltaTime / fadeOutTime;
                        fadedIn  = Mathf.Clamp(fadedIn, 0.0f, 1.0f);
                        SetAlpha(fadeCurve.Evaluate(fadedIn));
                        yield return(null);
                    }
                }
                yield return(new WaitForSecondsRealtime(monitorInterval));
            }
        }
Ejemplo n.º 3
0
 void OnPreRender()
 {
     if (!_provider.IsConnected())
     {
         return;
     }
     if (imagesEnabled)
     {
         Controller controller = _provider.GetLeapController();
         long       start      = controller.Now();
         while (!_requestedImage.IsComplete)
         {
             if (controller.Now() - start > ImageTimeout)
             {
                 break;
             }
         }
         if (_requestedImage.IsComplete)
         {
             if (_eyeTextureData.CheckStale(_requestedImage, _requestedImage))
             {
                 _eyeTextureData.Reconstruct(_requestedImage, _requestedImage);
             }
             _eyeTextureData.UpdateTextures(_requestedImage, _requestedImage);
         }
         else if (!checkingImageState)
         {
             StartCoroutine(checkImageMode());
         }
     }
 }
 protected void Start()
 {
     if (provider.IsConnected())
     {
         deviceInfo = provider.GetDeviceInfo();
         LeapVRCameraControl.OnValidCameraParams += onValidCameraParams;
         if (deviceInfo.type == LeapDeviceType.Invalid)
         {
             Debug.LogWarning("Invalid Leap Device -> enabled = false");
             enabled = false;
             return;
         }
     }
     else
     {
         StartCoroutine(waitForConnection());
         LeapWebSocketController controller = provider.GetLeapController();
         //controller.Device += OnDevice;
     }
 }