예제 #1
0
        void Awake()
        {
            if (Instance == null)
            {
                Instance = this;
            }
            else if (Instance != this)
            {
                Debug.LogError("There should only be one NSManager! Make sure there is only one NSManager prefab in the scene\n" +
                               "If there is no NSManager, one will be created for you!");
            }

            _imuCalibrator = new CalibratorWrapper(new MockImuCalibrator());

            //The plugin needs to load resources from your app's Streaming Assets folder
            _plugin = new NSVR.NSVR_Plugin();

            _trackingUpdateLoop = UpdateTracking();
            _suitStatusLoop     = CheckSuitConnection();

            DoDelayedAction(1.0f, delegate()
            {
                _suitStatus = ChangeSuitStatus(_plugin.PollStatus());
                StartCoroutine(_suitStatusLoop);
            });
        }
예제 #2
0
 IEnumerator CheckSuitConnection()
 {
     while (true)
     {
         var status = _plugin.PollStatus();
         if (status != _suitStatus)
         {
             _suitStatus = ChangeSuitStatus(status);
         }
         yield return(new WaitForSeconds(0.15f));
     }
 }
예제 #3
0
 private SuitStatus ChangeSuitStatus(SuitStatus newStatus)
 {
     if (newStatus == SuitStatus.Connected)
     {
         OnSuitConnected(new SuitConnectionArgs());
     }
     else
     {
         OnSuitDisconnected(new SuitConnectionArgs());
     }
     return(newStatus);
 }
예제 #4
0
 private void ChangeSuitStatus(SuitStatus newStatus)
 {
     if (newStatus != _suitStatus)
     {
         if (newStatus == SuitStatus.Connected)
         {
             OnSuitConnected(new SuitConnectionArgs());
         }
         else
         {
             OnSuitDisconnected(new SuitConnectionArgs());
         }
         _suitStatus = newStatus;
     }
 }
예제 #5
0
        void Awake()
        {
            if (Instance == null)
            {
                Instance = this;
            }
            else if (Instance != this)
            {
                Debug.LogError("There should only be one NSManager! Make sure there is only one NSManager prefab in the scene\n" +
                               "If there is no NSManager, one will be created for you!");
            }

            _imuCalibrator = new CalibratorWrapper(new MockImuCalibrator());

            //The plugin needs to load resources from your app's Streaming Assets folder
            _plugin = new NSVR.NSVR_Plugin(Application.streamingAssetsPath + "/Haptics");

            _trackingUpdateLoop = UpdateTracking();
            _suitStatus         = SuitStatus.Disconnected;
        }