void Update() { if (Input.GetMouseButtonDown(0)) { RaycastHit hit; if (Physics.Raycast(new Ray(transform.position, transform.forward), out hit, hitRange)) { if (hit.collider.gameObject.tag == "Breakable") { handeler.SomethingBroke(hit.collider.gameObject); } //Debug.DrawRay(transform.position, Vector3.forward); } } }
public void BrokeSomething(Collision coll) { handeler.SomethingBroke(coll.gameObject); }