private void SwitchCanceled(InputAction.CallbackContext context) { if (_currentCubeInput != null) { _currentCubeInput.HaveFocus = false; _currentCubeInput = null; } sceneInput.HaveFocus = false; }
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; } }
private void Awake() { _cubeInput = GetComponent <CubeInput>(); }