public CarFacade() { carWheels = new CarWheels(); carWheels = new CarWheels(); carBody = new CarBody(); carPaint = new CarPaint(); }
// ================================================================ // // 继承于MonoBehaviour void Awake() { this.input = new CarInput(this); this.wheels = new CarWheels(this); this.squeal_sound = this.gameObject.GetComponent <CarSoundSqueal>(); this.car_rigidbody = this.gameObject.GetComponent <Rigidbody>(); }
public CarFacade() { engine = new CarEngine(); seats = new CarSeats(); stereo = new CarStereo(); wheels = new CarWheels(); }
private void Drive() { CarWheels wheels = GetComponent <CarWheels>(); if (tempStop) { if (hasTrailer) { safeSpeed = Mathf.Lerp(safeSpeed, 0.0f, Time.fixedDeltaTime * (speedDecrease * 2.5f)); } else { safeSpeed = Mathf.Lerp(safeSpeed, 0, Time.fixedDeltaTime * speedDecrease); } if (safeSpeed < 0.15f) { safeSpeed = 0.0f; } } else { safeSpeed = Mathf.Lerp(safeSpeed, moveSpeed, Time.fixedDeltaTime * speedIncrease); } CarOverturned(); if (isACar) { for (int wheelIndex = 0; wheelIndex < wheels.WheelColliders.Length; wheelIndex++) { if (wheels.WheelColliders[wheelIndex].transform.localPosition.z > 0) { wheels.WheelColliders[wheelIndex].steerAngle = Mathf.Clamp(CarWheelsRotation.AngleSigned(transform.forward, movePath.finishPos - transform.position, transform.up), -30.0f, 30.0f); } } } if (rigbody.velocity.magnitude > safeSpeed) { rigbody.velocity = rigbody.velocity.normalized * safeSpeed; } }
private void Awake() { carWheels = GetComponent <CarWheels>(); }
public void Assemble(CarEngine engine, CarWheels carWheels) { }