Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (input.IsBraking() || input.IsHandbraking())
     {
         IntensifierLuminosite();
     }
     else
     {
         AllumerNormalementLumieres();
     }
 }
Exemplo n.º 2
0
    void Update()
    {
        float brakeTorqueToApply = vehicleInput.GetBraking() * brakeTorque;
        float steerAngle         = Input.GetAxis("Horizontal") * maxSteerAngle;

        foreach (Wheel wheel in wheels)
        {
            if (wheel.steering)
            {
                wheel.WheelCollider.steerAngle = steerAngle;
            }

            if (wheel.braking)
            {
                wheel.WheelCollider.brakeTorque = brakeTorqueToApply;
            }

            if (wheel.handbraking)
            {
                if (vehicleInput.IsHandbraking())
                {
                    wheel.WheelCollider.brakeTorque = handbrakeTorque;
                    wheel.EnableHandbrakeFriction();

                    if (wheel.braking)
                    {
                        wheel.WheelCollider.brakeTorque += brakeTorqueToApply;
                    }
                }
                else
                {
                    wheel.DisableHandbrakeFriction();
                }
            }
        }
    }