private void Update() { transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, lerpTime * Time.deltaTime); if (Input.GetMouseButtonUp(0)) { RaycastHit Hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out Hit, Mathf.Infinity, layerMask)) { ISelecionavel interacao = Hit.collider.GetComponent <ISelecionavel>(); if (interacao != null) { interacao.selecao(); } } } }
public void Selecionar(int index) { bool resposta = true; if (selecionavelAtual != null) { resposta = selecionavelAtual.Deselecionar(); } if (selecionavelAtual != selecionaveis[index]) { Debug.Log("MenuAberto"); selecionavelAtual = selecionaveis[index]; selecionavelAtual.Selecionar(); } else { if (resposta) { selecionavelAtual = null; LiberarJogo(); } } }