Exemple #1
0
        private void OnSelectionPerformed(InputAction.CallbackContext context)
        {
            if (!_isFigureLoaded)
            {
                return;
            }

            if (_shouldSelectSet && _figureSetInput != null)
            {
                _figureSetInput.HaveFocus = true;
                return;
            }

            var ray = _camera.ScreenPointToRay(Mouse.current.position.ReadValue());

            if (!Physics.Raycast(ray, out var hit))
            {
                return;
            }

            var figureInput = hit.collider.gameObject.GetComponent <FigureInput>();

            if (figureInput == null)
            {
                return;
            }

            figureInput.HaveFocus = true;
            _focusedFigureInput   = figureInput;
        }
Exemple #2
0
        private void OnSelectionCancelled(InputAction.CallbackContext context)
        {
            if (_figureSetInput != null)
            {
                _figureSetInput.HaveFocus = false;
            }

            if (_focusedFigureInput != null)
            {
                _focusedFigureInput.HaveFocus = false;
                _focusedFigureInput           = null;
            }
        }