void Update() { RaycastHit hit; if (Physics.Raycast(_user.position, _user.forward, out hit, Mathf.Infinity, _mask)) { if (_currentCube != null && hit.collider.gameObject != _currentCube._instructionBox) { _currentCube.HideInstruction(); ActivateCube(hit); } else if (_currentCube == null) { _currentCube = hit.collider.transform.parent.GetComponent <InstructionCube>(); ActivateCube(hit); } } }
void ActivateCube(RaycastHit hit) { _currentCube = hit.collider.transform.parent.GetComponent <InstructionCube>(); _currentCube.ShowInstruction(); _audio.PlayOneShot(AudioManager.Instance.GetAudioClip(GameAudioClipType.INSTRUCTION_ACTIVATE)); }