示例#1
0
        private void SwitchCanceled(InputAction.CallbackContext context)
        {
            if (_currentCubeInput != null)
            {
                _currentCubeInput.HaveFocus = false;
                _currentCubeInput           = null;
            }

            sceneInput.HaveFocus = false;
        }
示例#2
0
        private void SwitchPerformed(InputAction.CallbackContext context)
        {
            var ray             = _camera.ScreenPointToRay(Mouse.current.position.ReadValue());
            var giveInputToCube = false;

            if (Physics.Raycast(ray, out var hit))
            {
                _currentCubeInput = hit.collider.gameObject.GetComponent <CubeInput>();
                if (_currentCubeInput != null)
                {
                    giveInputToCube = true;
                }
            }

            if (giveInputToCube)
            {
                _currentCubeInput.HaveFocus = true;
                sceneInput.HaveFocus        = false;
            }
            else
            {
                sceneInput.HaveFocus = true;
            }
        }
示例#3
0
 private void Awake()
 {
     _cubeInput = GetComponent <CubeInput>();
 }