void Update() { m_lineRenderer.SetPosition(0, transform.position); Vector3 direction = transform.rotation * Vector3.forward; RaycastHit hit; if (Physics.Raycast(transform.position, direction, out hit, 100, m_hitLayerMask)) { m_lineRenderer.SetPosition(1, hit.point); GameObject hitObject = hit.collider.gameObject; LaserSelectable selectable = hitObject.GetComponent <LaserSelectable>(); if (selectable != null) { // selectable.sethi if (Input.GetMouseButtonDown(0)) { Explodable explodable = hitObject.GetComponent <Explodable>(); if (explodable != null) { m_catHead.Attack(explodable); } } } } else { m_lineRenderer.SetPosition(1, direction * 100); } }
void Update() { if (m_controllerIndex != -1 && m_explodable != null && SteamVR_Controller.Input(m_controllerIndex).GetPressDown(EVRButtonId.k_EButton_SteamVR_Trigger)) { CatHead catHead = FindObjectOfType <CatHead>(); catHead.Attack(m_explodable); m_explodable = null; } }