void Update() { if (itemBeingAimed == null) { return; //If there is no item being aimed, don't do anything. } //Try to find a point on the map the player is aiming at, and do nothing if it does not exist. Vector3 aimPoint = GetAimPoint(); if (aimPoint.Equals(Vector3.positiveInfinity)) { return; } itemBeingAimed.VisualiseAim(userTransform, aimPoint); //When the user releases the mouse button again, fire the item, stop aiming, and unlock the camera. if (Input.GetMouseButtonUp(0)) { player.Fire(); itemBeingAimedInventory.StartCooldown(itemBeingAimedInventory.getPositionOfItem(itemBeingAimed)); StartCoroutine(WaitThenFire(aimPoint)); } }