/// <summary> /// Change Wheel Models. You can find your wheel models array in Tools --> BCG --> RCC --> Configure Changable Wheels. /// </summary> public static void ChangeWheels(RCC_CarControllerV3 vehicle, GameObject wheel, bool applyRadius) { if (!CheckVehicle(vehicle)) { return; } for (int i = 0; i < vehicle.allWheelColliders.Length; i++) { if (vehicle.allWheelColliders [i].wheelModel.GetComponent <MeshRenderer> ()) { vehicle.allWheelColliders [i].wheelModel.GetComponent <MeshRenderer> ().enabled = false; } foreach (Transform t in vehicle.allWheelColliders[i].wheelModel.GetComponentInChildren <Transform> ()) { t.gameObject.SetActive(false); } GameObject newWheel = (GameObject)Instantiate(wheel, vehicle.allWheelColliders[i].wheelModel.position, vehicle.allWheelColliders[i].wheelModel.rotation, vehicle.allWheelColliders[i].wheelModel); if (vehicle.allWheelColliders [i].wheelModel.localPosition.x > 0f) { newWheel.transform.localScale = new Vector3(newWheel.transform.localScale.x * -1f, newWheel.transform.localScale.y, newWheel.transform.localScale.z); } if (applyRadius) { vehicle.allWheelColliders [i].wheelCollider.radius = RCC_GetBounds.MaxBoundsExtent(wheel.transform); } } OverrideRCC(vehicle); }
public void UpdateStats() { carController.maxspeed = Mathf.Lerp(defMaxSpeed, maxUpgradeSpeed, _speedLevel / 5f); carController.highwaySteeringHelper = Mathf.Lerp(defHandling, maxUpgradeHandling, _handlingLevel / 5f); carController.highwayBrakingHelper = Mathf.Lerp(defMaxBrake, maxUpgradeBrake, _brakeLevel / 5f); if (bodyRenderer) { bodyRenderer.sharedMaterials[materialIndex].color = bodyColor; } // else // Debug.LogError("Missing Body Renderer On ModApllier Component"); if (isSirenPurchased && !attachedFrontSiren) { CreateSiren(); } if (isNOSPurchased) { carController.useNOS = true; } else { carController.useNOS = false; } if (isTurboPurchased) { carController.useTurbo = true; } else { carController.useTurbo = false; } if (selectedWheel) { ChangeWheels(carController, selectedWheel); carController.FrontLeftWheelCollider.wheelCollider.radius = RCC_GetBounds.MaxBoundsExtent(selectedWheel.transform); carController.FrontRightWheelCollider.wheelCollider.radius = RCC_GetBounds.MaxBoundsExtent(selectedWheel.transform); carController.RearLeftWheelCollider.wheelCollider.radius = RCC_GetBounds.MaxBoundsExtent(selectedWheel.transform); carController.RearRightWheelCollider.wheelCollider.radius = RCC_GetBounds.MaxBoundsExtent(selectedWheel.transform); PlayerPrefs.SetInt(transform.name + "SelectedWheel", wheelIndex); } PlayerPrefs.SetInt(transform.name + "SpeedLevel", _speedLevel); PlayerPrefs.SetInt(transform.name + "HandlingLevel", _handlingLevel); PlayerPrefs.SetInt(transform.name + "BrakeLevel", _brakeLevel); PlayerPrefsX.SetColor(transform.name + "BodyColor", bodyColor); PlayerPrefsX.SetBool(transform.name + "Siren", isSirenPurchased); PlayerPrefsX.SetBool(transform.name + "NOS", isNOSPurchased); PlayerPrefsX.SetBool(transform.name + "Turbo", isTurboPurchased); }
public IEnumerator AutoFocus(Transform bounds1, Transform bounds2, Transform bounds3) { float timer = 5f; while (timer > 0f) { timer -= Time.deltaTime; TPSDistance = Mathf.Lerp(TPSDistance, ((RCC_GetBounds.MaxBoundsExtent(bounds1) * 2.75f) + (RCC_GetBounds.MaxBoundsExtent(bounds2) * 2.75f) + (RCC_GetBounds.MaxBoundsExtent(bounds3) * 2.75f)), Time.deltaTime); TPSHeight = Mathf.Lerp(TPSHeight, ((RCC_GetBounds.MaxBoundsExtent(bounds1) * .6f) + (RCC_GetBounds.MaxBoundsExtent(bounds2) * .6f) + (RCC_GetBounds.MaxBoundsExtent(bounds3) * .6f)), Time.deltaTime); yield return(null); } }
public IEnumerator AutoFocus() { float timer = 5f; while (timer > 0f) { timer -= Time.deltaTime; TPSDistance = Mathf.Lerp(TPSDistance, RCC_GetBounds.MaxBoundsExtent(playerCar.transform) * 2.75f, Time.deltaTime); TPSHeight = Mathf.Lerp(TPSHeight, RCC_GetBounds.MaxBoundsExtent(playerCar.transform) * .6f, Time.deltaTime); yield return(null); } }
public IEnumerator AutoFocus(Transform bounds) { float timer = 3f; while (timer > 0f) { timer -= Time.deltaTime; TPSDistance = Mathf.Lerp(TPSDistance, RCC_GetBounds.MaxBoundsExtent(bounds) * 2.15f, Time.deltaTime); TPSHeight = Mathf.Lerp(TPSHeight, RCC_GetBounds.MaxBoundsExtent(bounds) * .5f, Time.deltaTime); yield return(null); } }