I think this should work.
static var maxSpeed = 0;
private var lightOn = false;
Update () {
if (Input.GetKeyDown(KeyCode.Q)){
if(lightOn==false){
lightOn = true;
maxSpeed = 1;
}
else{
lightOff = false
maxSpeed = 2;
}
}
}
↧