Hello.
In my car game, I implemented nitro, when you apply it it multiplies the motortorque of the wheel colliders by two. But there’s somethings I whant to do but i can’t :
I want to give the nitro a duration (for exemple, it lasts 4 seconds) and then i want it to take a time to recharge.
I want to make a nitro bar associated with it (it shrinks as you use the nitro and grows as it recharges)
There is my nitro script :
*It is part of the car controller
void FixedUpdate()
{
NitroSystem();
}
void NitroSystem()
{
if(inputManager.nitro)
{
nitroIsOn = true;
}
else
{
nitroIsOn = false;
}
if(nitroIsOn == true)
{
nitroValue = 5f;
topSpeed = topSpeedValue * 2f;
}
else if (nitroIsOn == false)
{
nitroValue = 1f;
topSpeed = topSpeedValue;
}
}