private bool Capture() { bool isCapturing = false; if (capture) { //There's a bug where you can capture unspawned vehicles, should probably check if active in heirarchy. Needs more testing if (currentTarget != null) { float targetDistance = (currentTarget.GetVehicle().vehicleRigidbody.transform.position - self.GetVehicle().vehicleRigidbody.transform.position).magnitude; if (targetDistance <= GetCaptureDistance() / 2) { isCapturing = true; if (startCaptureTime < 0) { startCaptureTime = Time.time; } int currentCaptureTimeLevel = Mathf.Clamp(captureTimeLevel, 0, captureTimes.Length - 1); if (Time.time - startCaptureTime >= captureTimes[currentCaptureTimeLevel]) { BountyTracker.bountyTrackerInScene.Catch(currentTarget.GetCarability().license); Debug.Log("Captured " + currentTarget.GetCarability().license); //Caught isCapturing = false; } } } } if (!isCapturing) { startCaptureTime = -1; } return(isCapturing); }
void Update() { if (cameraBridge == null) { cameraBridge = GameObject.FindGameObjectWithTag("HighwayCam")?.GetComponent <CarCameraBridge>(); } if (cameraBridge != null) { hudTransform.localScale = Vector3.Lerp(closeScale, farScale, cameraBridge.orthoPercent); } Reposition(); if (showLicense) { licenseLabel.text = self.GetCarability().license; } pointer.SetActive(showPointer); license.SetActive(showLicense); }