예제 #1
0
        protected virtual void OnDisable()
        {
            for (int i = _graspedBehaviours.Count; i-- != 0;)
            {
                ReleaseObject(_graspedBehaviours[i]);
            }

            _activityManager.UnregisterMisbehavingObjects();

            _idToInteractionHand.Clear();
            _graspedBehaviours.Clear();

            _activityManager.DeactivateAll();
            _activityManager.OnActivate   -= createInteractionShape;
            _activityManager.OnDeactivate -= destroyInteractionShape;

            Assert.AreEqual(_instanceHandleToBehaviour.Count, 0, "All instances should have been destroyed.");

            if (_shapeDescriptionPool != null)
            {
                _shapeDescriptionPool.RemoveAllShapes();
                _shapeDescriptionPool = null;
            }

            if (_hasSceneBeenCreated)
            {
                destroyScene();
            }
        }
예제 #2
0
        protected virtual void OnEnable()
        {
            if (_leapProvider == null)
            {
                enabled = false;
                Debug.LogError("Could not enable Interaction Manager because no Leap Provider was specified.");
                return;
            }

            Assert.IsFalse(_hasSceneBeenCreated, "Scene should not have been created yet");

            createScene();
            applyDebugSettings();

            _shapeDescriptionPool = new ShapeDescriptionPool(_scene);

            Assert.AreEqual(_instanceHandleToBehaviour.Count, 0, "There should not be any instances before the creation step.");

            _cachedSimulationScale = _leapProvider.transform.lossyScale.x;

            _activityManager.BrushLayer    = InteractionBrushLayer;
            _activityManager.OverlapRadius = _activationRadius * _cachedSimulationScale;
            _activityManager.MaxDepth      = _maxActivationDepth;
            _activityManager.OnActivate   += createInteractionShape;
            _activityManager.OnDeactivate += destroyInteractionShape;

            if (_handPool != null)
            {
                if (_contactEnabled)
                {
                    _handPool.EnableGroup(_brushGroupName);
                }
                else
                {
                    _handPool.DisableGroup(_brushGroupName);
                }
            }
        }
예제 #3
0
    protected virtual void OnDisable() {
      for (int i = _graspedBehaviours.Count; i-- != 0;) {
        ReleaseObject(_graspedBehaviours[i]);
      }

      _activityManager.UnregisterMisbehavingObjects();

      _idToInteractionHand.Clear();
      _graspedBehaviours.Clear();

      _activityManager.DeactivateAll();
      _activityManager.OnActivate -= createInteractionShape;
      _activityManager.OnDeactivate -= destroyInteractionShape;

      Assert.AreEqual(_instanceHandleToBehaviour.Count, 0, "All instances should have been destroyed.");

      if (_shapeDescriptionPool != null) {
        _shapeDescriptionPool.RemoveAllShapes();
        _shapeDescriptionPool = null;
      }

      if (_hasSceneBeenCreated) {
        destroyScene();
      }
    }
예제 #4
0
    protected virtual void OnEnable() {
      if (_leapProvider == null) {
        enabled = false;
        Debug.LogError("Could not enable Interaction Manager because no Leap Provider was specified.");
        return;
      }

      Assert.IsFalse(_hasSceneBeenCreated, "Scene should not have been created yet");

      createScene();
      applyDebugSettings();

      _shapeDescriptionPool = new ShapeDescriptionPool(_scene);

      Assert.AreEqual(_instanceHandleToBehaviour.Count, 0, "There should not be any instances before the creation step.");

      _cachedSimulationScale = _leapProvider.transform.lossyScale.x;

      _activityManager.BrushLayer = InteractionBrushLayer;
      _activityManager.OverlapRadius = _activationRadius * _cachedSimulationScale;
      _activityManager.MaxDepth = _maxActivationDepth;
      _activityManager.OnActivate += createInteractionShape;
      _activityManager.OnDeactivate += destroyInteractionShape;

      if (_handPool != null) {
        if (_contactEnabled) {
          _handPool.EnableGroup(_brushGroupName);
        } else {
          _handPool.DisableGroup(_brushGroupName);
        }
      }
    }