예제 #1
0
 /// <summary>
 /// Handles the event for button down.
 /// </summary>
 /// <param name="controllerId">The id of the controller.</param>
 /// <param name="button">The button that is being pressed.</param>
 private void HandleOnButtonDown(byte controllerId, MLInput.Controller.Button button)
 {
     if ((_mobileControllerConnectionHandler.IsControllerValid(controllerId) || _controllerConnectionHandler.IsControllerValid(controllerId)) && button == MLInput.Controller.Button.Bumper)
     {
         PlaceContactsVisualizerFromCamera();
     }
 }
예제 #2
0
        /// <summary>
        /// Handles the event for button down.
        /// </summary>
        /// <param name="controller_id">The id of the controller.</param>
        /// <param name="button">The button that is being pressed.</param>
        private void HandleOnButtonDown(byte controllerId, MLInput.Controller.Button button)
        {
            if (_controllerConnectionHandler.IsControllerValid(controllerId) && button == MLInput.Controller.Button.Bumper)
            {
                switch (_worldScale.Measurement)
                {
                case MLWorldScaleBehavior.ScaleMeasurement.Meters:
                    _worldScale.Measurement = MLWorldScaleBehavior.ScaleMeasurement.Decimeters;
                    break;

                case MLWorldScaleBehavior.ScaleMeasurement.Decimeters:
                    _worldScale.Measurement = MLWorldScaleBehavior.ScaleMeasurement.Centimeters;
                    break;

                case MLWorldScaleBehavior.ScaleMeasurement.Centimeters:
                    _worldScale.Measurement = MLWorldScaleBehavior.ScaleMeasurement.CustomUnits;
                    break;

                case MLWorldScaleBehavior.ScaleMeasurement.CustomUnits:
                    _worldScale.Measurement = MLWorldScaleBehavior.ScaleMeasurement.Meters;
                    break;

                default:
                    Debug.LogError("Error: WorldScaleExample measurement type is an invalid value, disabling script.");
                    enabled = false;
                    return;
                }

                _worldScale.UpdateWorldScale();
            }
        }
예제 #3
0
 private void OnButtonDown(byte controller_id, MLInput.Controller.Button button)
 {
     if (_controllerConnectionHandler.IsControllerValid(controller_id) && button == MLInput.Controller.Button.Bumper)
     {
         TranslateLightingCanvas();
     }
 }
예제 #4
0
 /// <summary>
 /// Handles the event for button down.
 /// </summary>
 /// <param name="controllerId">The id of the controller.</param>
 /// <param name="button">The button that is being pressed.</param>
 private void OnButtonDown(byte controllerId, MLInput.Controller.Button button)
 {
     if (_controllerConnectionHandler.IsControllerValid(controllerId) && MLInput.Controller.Button.Bumper == button && !_isCapturing)
     {
         TriggerAsyncCapture();
     }
 }
예제 #5
0
 /// OnButtonUp
 /// Button event - when bumper is tapped: show summary
 /// Button event - when bumper is tapped again: reset scene
 private void OnButtonUp(byte controller_id, MLInput.Controller.Button button)
 {
     if (wallStat == WallStat.Summary)
     {
         if (button == MLInput.Controller.Button.Bumper)
         {
             scoreKeeper.ResetScore();
         }
         else if (button == MLInput.Controller.Button.HomeTap)
         {
             summaryText.enabled    = false;
             spawnMngr.enabled      = false;
             scoreText.enabled      = false;
             statusText.enabled     = false;
             beamController.enabled = true;
             menu.SetActive(true);
             wallStat = WallStat.Menu;
         }
     }
     else if (wallStat != WallStat.Empty)      // in settings or help page
     {
         settings.SetActive(false);
         helpText.enabled = false;
         wallStat         = WallStat.Menu;
         menu.SetActive(true);
     }
 }
예제 #6
0
 /// <summary>
 /// Handles the event for button down.
 /// Toggles if the wacom tablet should update it's placement to the user position.
 /// </summary>
 /// <param name="controllerId">The id of the controller.</param>
 /// <param name="button">The button that is being pressed.</param>
 private void HandleOnButtonDown(byte controllerId, MLInput.Controller.Button button)
 {
     if (_controllerConnectionHandler.IsControllerValid(controllerId) && button == MLInput.Controller.Button.HomeTap)
     {
         _wacomTabletPlacement.PlaceOnUpdate = !_wacomTabletPlacement.PlaceOnUpdate;
     }
 }
        /// <summary>
        /// Handles the event for when the controller's Bumper is pressed.
        /// </summary>
        private void HandleOnButtonPressed(byte controllerid, MLInput.Controller.Button button)
        {
            if (button == MLInput.Controller.Button.Bumper)
            {
                if (_firstPlacement == true)
                {
                    PlaceContent();

                    PlanesVisualizer pv = GetComponent <PlanesVisualizer>();
                    if (pv != null)
                    {
                        Destroy(pv);
                    }

                    if (_planes != null)
                    {
                        Destroy(_planes);
                    }

                    _firstPlacement = false;
                    Cursor.gameObject.SetActive(true);
                    StatusLabel.gameObject.SetActive(true);
                }

                else if (_isValid == true)
                {
                    _placedContent.Add(_obj);
                    _obj     = null;
                    _isValid = false;
                }
            }
        }
예제 #8
0
 private void HandleOnButtonDown(byte controllerId, MLInput.Controller.Button button)
 {
     if (button == MLInput.Controller.Button.Bumper)
     {
         StartCoroutine("SingleFrameUpdate");
     }
 }
예제 #9
0
 /// <summary>
 /// Updates the _rotation's y component to 90 when the Bumper button is pressed down
 /// </summary>
 /// <param name="controllerId"></param>
 /// <param name="button"></param>
 void OnButtonDown(byte controllerId, MLInput.Controller.Button button)
 {
     if (button == MLInput.Controller.Button.Bumper)
     {
         _rotation.y = 90;
     }
 }
 /// <summary>
 /// Handles the event for button down.
 /// </summary>
 /// <param name="controllerId">The id of the controller.</param>
 /// <param name="button">The button that is being pressed.</param>
 private void HandleOnButtonDown(byte controllerId, MLInput.Controller.Button button)
 {
     if (_controllerConnectionHandler.IsControllerValid(controllerId) && button == MLInput.Controller.Button.Bumper)
     {
         _leftButtonHighlight.SetActive(true);
     }
 }
예제 #11
0
 /// <summary>
 /// Handles the event for button down.
 /// </summary>
 /// <param name="controllerId">The id of the controller.</param>
 /// <param name="button">The button that is being pressed.</param>
 private void HandleOnButtonDown(byte controllerId, MLInput.Controller.Button button)
 {
     if (_controllerConnectionHandler.IsControllerValid(controllerId) && button == MLInput.Controller.Button.Bumper)
     {
         PlaceMusicServiceVisualizerFromCamera();
     }
 }
예제 #12
0
 /// <summary>
 /// Handles the event for button down.
 /// </summary>
 /// <param name="controllerId">The id of the controller.</param>
 /// <param name="button">The button that is being released.</param>
 private void HandleOnButtonDown(byte controllerId, MLInput.Controller.Button button)
 {
     if (_controllerConnectionHandler.IsControllerValid(controllerId) && button == MLInput.Controller.Button.Bumper)
     {
         ToggleVisualizers();
     }
 }
 /// <summary>
 /// Handles the event for button down and cycles the raycast mode.
 /// </summary>
 /// <param name="controllerId">The id of the controller.</param>
 /// <param name="button">The button that is being pressed.</param>
 private void OnButtonDown(byte controllerId, MLInput.Controller.Button button)
 {
     if (_controllerConnectionHandler.IsControllerValid(controllerId) && button == MLInput.Controller.Button.Bumper)
     {
         _raycastMode = (RaycastMode)((int)(_raycastMode + 1) % _modeCount);
         UpdateRaycastMode();
     }
 }
예제 #14
0
 /// <summary>
 /// Handles the event for button down and cycles the raycast mode.
 /// </summary>
 /// <param name="controller_id">The id of the controller.</param>
 /// <param name="button">The button that is being pressed.</param>
 private void OnButtonDown(byte controller_id, MLInput.Controller.Button button)
 {
     if (button == MLInput.Controller.Button.Bumper)
     {
         _raycastMode = (RaycastMode)((int)(_raycastMode + 1) % _modeCount);
         UpdateRaycastMode();
         UpdateStatusText();
     }
 }
예제 #15
0
 private void HandleOnButtonDown(byte controllerId, MLInput.Controller.Button button)
 {
     if (_controllerConnectionHandler.IsControllerValid(controllerId))
     {
         if (button == MLInput.Controller.Button.Bumper)
         {
             StartCoroutine("SingleFrameUpdate");
         }
     }
 }
예제 #16
0
 /// <summary>
 /// Handles the event for button down and cycles the raycast mode.
 /// </summary>
 /// <param name="controllerId">The id of the controller.</param>
 /// <param name="button">The button that is being pressed.</param>
 private void OnButtonDown(byte controllerId, MLInput.Controller.Button button)
 {
     if (_controllerConnectionHandler.IsControllerValid(controllerId) && button == MLInput.Controller.Button.Bumper)
     {
         //_raycastMode = (RaycastMode)((int)(_raycastMode + 1) % _modeCount);
         //UpdateRaycastMode();
         Debug.Log("Bumper Press");
         PlaceDevice(posToMove);
     }
 }
예제 #17
0
 void OnButtonDown(byte controllerId, MLInput.Controller.Button button)
 {
     if (button == MLInput.Controller.Button.HomeTap)
     {
         Application.Quit();
     }
     else if (button == MLInput.Controller.Button.Bumper)
     {
     }
 }
예제 #18
0
 /// <summary>
 /// Updates the _rotation's y component to 0 when the Bumper button is released
 /// Resets the Cube's orientation to its original orientation, when the Home Button is pressed and released
 /// </summary>
 /// <param name="controllerId"></param>
 /// <param name="button"></param>
 void OnButtonUp(byte controllerId, MLInput.Controller.Button button)
 {
     if (button == MLInput.Controller.Button.Bumper)
     {
         _rotation.y = 0;
     }
     if (button == MLInput.Controller.Button.HomeTap)
     {
         //      _cube.transform.rotation = _originalOrientation;
     }
 }
예제 #19
0
 /// <summary>
 /// Handles the event for button down.
 /// </summary>
 /// <param name="controllerId">The id of the controller.</param>
 /// <param name="button">The button that is being pressed.</param>
 private void HandleOnButtonDown(byte controllerId, MLInput.Controller.Button button)
 {
     #if PLATFORM_LUMIN
     if (_controllerConnectionHandler.IsControllerValid() && _controllerConnectionHandler.ConnectedController.Id == controllerId &&
         button == MLInput.Controller.Button.Bumper)
     {
         // Sets the color of the Bumper to the active color.
         _bumperButtonMaterial.color = _activeColor;
     }
     #endif
 }
예제 #20
0
 private void ConfirmArea_HandleControllerButton(byte controllerId, MLInput.Controller.Button button)
 {
     switch (button)
     {
     case MLInput.Controller.Button.Bumper:
         PlayerPrefs.DeleteKey(_sessionDataKey);
         PlayerPrefs.DeleteKey(_sessionMeshKey);
         Create();
         break;
     }
 }
예제 #21
0
 void HandleOnButtonUp(byte controllerId, MLInput.Controller.Button button)
 {
     if (button == MLInput.Controller.Button.HomeTap)
     {
         _homePressed = false;
     }
     // if (button == MLInput.Controller.Button.Bumper)
     // {
     //     _bumperPressed = false;
     // }
 }
예제 #22
0
        /// <summary>
        /// Handles the event for button up.
        /// </summary>
        /// <param name="controller_id">The id of the controller.</param>
        /// <param name="button">The button that is being released.</param>
        private void HandleOnButtonUp(byte controllerId, MLInput.Controller.Button button)
        {
            MLInput.Controller controller = _controllerConnectionHandler.ConnectedController;

            #if PLATFORM_LUMIN
            if (controller != null && controller.Id == controllerId &&
                button == MLInput.Controller.Button.Bumper)
            {
                // Demonstrate haptics using callbacks.
                controller.StartFeedbackPatternVibe(MLInput.Controller.FeedbackPatternVibe.ForceUp, MLInput.Controller.FeedbackIntensity.Medium);
            }
            #endif
        }
예제 #23
0
        private void HandleControllerButtonDown(byte controllerId, MLInput.Controller.Button button)
        {
            if (_controllerConnectionHandler.IsControllerValid(controllerId) && _lastButtonHit != null && !_isGrabbing)
            {
                _lastButtonHit.OnControllerButtonDown?.Invoke(button);
                _pointerLight.color = _pointerLightColorHitPress;

                if (_grabWithBumper && button == MLInput.Controller.Button.Bumper)
                {
                    _isGrabbing = true;
                }
            }
        }
예제 #24
0
 /// <summary>
 /// Handles the event for button down. Starts or stops recording.
 /// </summary>
 /// <param name="controllerId">The id of the controller.</param>
 /// <param name="button">The button that is being pressed.</param>
 private void OnButtonDown(byte controllerId, MLInput.Controller.Button button)
 {
     if (_controllerConnectionHandler.IsControllerValid(controllerId) && MLInput.Controller.Button.Bumper == button)
     {
         if (!_isCapturing)
         {
             StartCapture();
         }
         else
         {
             EndCapture();
         }
     }
 }
 /// <summary>
 /// Handles the event for button up.
 /// </summary>
 /// <param name="controllerId">The id of the controller.</param>
 /// <param name="button">The button that is being released.</param>
 private void HandleOnButtonUp(byte controllerId, MLInput.Controller.Button button)
 {
     if (_controllerConnectionHandler.IsControllerValid(controllerId))
     {
         if (button == MLInput.Controller.Button.Bumper)
         {
             _leftButtonHighlight.SetActive(false);
         }
         else if (button == MLInput.Controller.Button.HomeTap)
         {
             _homeTapIndicator.SetActive(true);
             _timeToDeactivateHome = Time.time + _homeActiveDuration;
         }
     }
 }
예제 #26
0
    void OnButtonUp(byte controller_id, MLInput.Controller.Button button)
    {
        // Callback - Button Up
        if (button == MLInput.Controller.Button.Bumper)
        {
            BumperUp.Invoke();
            BumperPressed = false;
        }

        if (button == MLInput.Controller.Button.HomeTap)
        {
            HomeButtonUp.Invoke();
            HomeButtonPressed = false;
        }
    }
예제 #27
0
    void OnButtonDown(byte controller_id, MLInput.Controller.Button button)
    {
        // Callback - Button Down
        if (button == MLInput.Controller.Button.Bumper)
        {
            BumperDown.Invoke();
            BumperPressed = true;
        }

        if (button == MLInput.Controller.Button.HomeTap)
        {
            HomeButtonDown.Invoke();
            HomeButtonPressed = true;
        }
    }
        private void MLInput_OnControllerButtonDown(byte controllerId, MLInput.Controller.Button button)
        {
            if (button == MLInput.Controller.Button.Bumper)
            {
                isOcclusion = !isOcclusion;

                if (isOcclusion)
                {
                    meshingVisualizer.SetRenderers(MagicLeap.MeshingVisualizer.RenderMode.Occlusion);
                }
                else
                {
                    meshingVisualizer.SetRenderers(MagicLeap.MeshingVisualizer.RenderMode.Wireframe);
                }
            }
        }
예제 #29
0
 /// <summary>
 /// For Mobile App, this initiates/ends the recalibration when the home tap event is triggered
 /// </summary>
 /// <param name="controllerId">The id of the controller.</param>
 /// <param name="button">The button that is being released.</param>
 private void HandleOnButtonUp(byte controllerId, MLInput.Controller.Button button)
 {
     #if PLATFORM_LUMIN
     MLInput.Controller controller = _controllerConnectionHandler.ConnectedController;
     if (_controllerConnectionHandler.IsControllerValid(controllerId) &&
         controller.Type == MLInput.Controller.ControlType.MobileApp &&
         button == MLInput.Controller.Button.HomeTap)
     {
         if (!_isCalibrated)
         {
             _calibrationOrientation = transform.rotation * Quaternion.Inverse(controller.Orientation);
         }
         _isCalibrated = !_isCalibrated;
     }
     #endif
 }
예제 #30
0
        /// <summary>
        /// Handles the event for button down. Changes render mode if bumper is pressed or
        /// changes from bounded to boundless and viceversa if home button is pressed.
        /// </summary>
        /// <param name="controllerId">The id of the controller.</param>
        /// <param name="button">The button that is being released.</param>
        private void OnButtonDown(byte controllerId, MLInput.Controller.Button button)
        {
            if (_controllerConnectionHandler.IsControllerValid(controllerId))
            {
                if (button == MLInput.Controller.Button.Bumper)
                {
                    _meshingVisualizer.SetNextRendereMode();
                }
                else if (button == MLInput.Controller.Button.HomeTap)
                {
                    _bounded = !_bounded;

                    _visualBounds.SetActive(_bounded);
                    _meshingBehavior.gameObject.transform.localScale = _bounded ? _boundedExtentsSize : _boundlessExtentsSize;
                }
            }
        }