private void Update() { if (Time.timeScale == 0) { return; } Ray r = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; Vector3 hitpos = Vector3.zero; if (Physics.Raycast(r, out hit, Mathf.Infinity, mouseCastLayer)) { hitpos = hit.point; } lookDirection = hitpos - transform.position; lookDirection.y = 0; transform.LookAt(transform.position + lookDirection, Vector3.up); transform.localEulerAngles = new Vector3(0, AngleHelper.ClampAngle(transform.localEulerAngles.y, -halfAngleExtent, halfAngleExtent), transform.localEulerAngles.z); aimGuide.positionCount = 2; aimGuide.SetPosition(0, firePoint.position); aimGuide.SetPosition(1, -firePoint.forward * 1000 + transform.position); lightRay.positionCount = 2; lightRay.SetPosition(0, firePoint.position); lightRay.SetPosition(1, -firePoint.forward * 1000 + transform.position); if (Input.GetMouseButtonDown(0)) { StartCoroutine(Shoot()); } HandleRay(); }