// Update is called once per frame void Update() { if (isClone) { return; } if (mainCamera == null) { FindCamera(); } // Debug.DrawRay (cameraTransform.position, cameraTransform.forward * 100, Color.magenta); if (Physics.Raycast(cameraTransform.position, cameraTransform.forward.normalized, out hit, 500, ShotLayerMask)) { aimHasTarget = true; bulletTargetPoint = hit.point; NowTargeting = hit.transform.gameObject; //Debug.Log ("Hit: " + hit.transform.gameObject.name + " in " + hit.point); Debug.DrawRay(cameraTransform.position, hit.point - cameraTransform.position, Color.yellow); } else { aimHasTarget = false; bulletTargetPoint = cameraTransform.forward; } if (Input.GetMouseButtonDown(0)) { if (canShoot) { if (Time.time - lastShotTime > shotDelay) { Hashtable data = new Hashtable(); data.Add("type", "shoot"); data.Add("aimHasTarget", aimHasTarget); data.Add("bulletTargetPoint", bulletTargetPoint); data.Add("muzzlePosition", muzzlePositionHolder.transform.position); Shoot(data); recorder.AddEvent(data); } } else { UIManager.instance.SendMessage("CANNOT SHOOT WHILE DISARMING"); } } }