コード例 #1
0
 public CarFacade()
 {
     carWheels = new CarWheels();
     carWheels = new CarWheels();
     carBody   = new CarBody();
     carPaint  = new CarPaint();
 }
コード例 #2
0
    // ================================================================ //
    // 继承于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>();
    }
コード例 #3
0
 public CarFacade()
 {
     engine = new CarEngine();
     seats  = new CarSeats();
     stereo = new CarStereo();
     wheels = new CarWheels();
 }
コード例 #4
0
    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;
        }
    }
コード例 #5
0
ファイル: CarMovement.cs プロジェクト: AntMike/Crossroad
 private void Awake()
 {
     carWheels = GetComponent <CarWheels>();
 }
コード例 #6
0
 public void Assemble(CarEngine engine, CarWheels carWheels)
 {
 }