Exemple #1
0
 public void OnAwake()
 {
     ragdollRender     = driverPhysics.GetComponentsInChildren <SkinnedMeshRenderer>();
     driverRender      = driver.GetComponentsInChildren <SkinnedMeshRenderer>();
     colliders         = GetComponentsInChildren <Collider>();
     bodyes            = GetComponentsInChildren <Rigidbody>();
     driverTransforms  = driver.GetComponentsInChildren <Transform>();
     ragdollTransforms = driverPhysics.GetComponentsInChildren <Transform>();
 }
Exemple #2
0
        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");
        }