protected virtual void Awake() { animator = GetComponent <Animator>(); vehicle = transform.root.GetComponent <Vehicle>(); if (!vehicle) { enabled = false; return; } steering = vehicle.GetComponentInChildren <Steering>(); if (!steering) { enabled = false; return; } Collider bodyCollider = GetComponentInParent <Vehicle>().bodyCollider; Collider crashCollider = GetComponentInChildren <CrashChecker>().GetComponent <Collider>(); vehicleController = GetComponentInParent <VehicleUserController>(); foreach (var item in driverPhysics.GetComponentsInChildren <Collider>()) { Physics.IgnoreCollision(bodyCollider, item); Physics.IgnoreCollision(crashCollider, item); } driverPhysics.OnAwake(); driverPhysics.SetActive(false); driverIK = vehicle.transform.Find("DriverIK"); driver = vehicle.transform.Find("Driver"); }
public IEnumerator Resset() { if (!isActive) { while (Vector3.Dot(vehicle.transform.up, Vector3.up) < 0.2f) { yield return(null); } StopCoroutine("WaitAndActivate"); StartCoroutine("WaitAndActivate"); driver.vehicleController.StopControl(); driver.vehicleController.enabled = true; checker.enabled = true; GetComponent <Rigidbody>().isKinematic = false; driverPhysics.SetActive(false); } }