vehicle decceleration and angle reseting

I have this script for the back wheels of a car

function FixedUpdate () {

if(Input.GetKeyDown(KeyCode.W)) {

collider.motorTorque = 30;
}

if(Input.GetKeyDown(KeyCode.S)) {

collider.motorTorque = -20;
}

}

and this for the front wheels

function FixedUpdate () {
if(Input.GetKey(KeyCode.A)) {

collider.steerAngle = -5;
}

if(Input.GetKey(KeyCode.D)) {

collider.steerAngle = 5;
}

}

How do i get the car to rather Constantly accelerate when i press a key or constantly turn, get it to to: deccelerate in the first script, and reset turning angle in the second?

thanks.

You might want to consider using GetAxis instead of reading the keys directly (since both WSAD and the arrow keys are mapped to the horizontal and vertical axes). The axis readings move smoothly from 0 to 1 or -1 when the keys are pressed, and back again when released.

So you could use something like this for your steering:

function FixedUpdate() {

    var h = Input.GetAxis("Horizontal");
    collider.steerAngle = h*5;

}

And like this for the motorised wheels:

function FixedUpdate() {

    var v = Input.GetAxis("Vertical");
    if (v > 0) {
        collider.motorTorque = v*30;
    } else {
        collider.motorTorque = v*20;
    }

}

You might find that your car naturally slows when cornering as an emergent behaviour from the wheel's slip and grip features.