public void Update() { if (_Game) { return; } var r = CameraMain.ScreenPointToRay(Input.mousePosition); RaycastHit h; if (Input.GetMouseButtonDown(1)) { Reset(); } if (Input.GetMouseButtonDown(0) && Physics.Raycast(r, out h)) { Damage(h.point, r.direction); Debug.DrawRay(h.point, h.normal, Color.white, 10); } }
public static bool Intersects(Renderer Renderer) { bool intersectRay = interFrame != Time.frameCount && Renderer.bounds.IntersectRay(CameraMain.ScreenPointToRay(Input.mousePosition)); if (intersectRay) { interFrame = Time.frameCount; } return(intersectRay); }