if (carController.driftingNow == true)
{
updatingScore++;
}
else if (I don’t know what to use in the statement)
{
// Reset drift score to 0
}
When you’re writing an if statement using a boolean, you can actually do it a couple of different ways, but the way I personally would do it here is
if (carController.driftingNow == true)
{
updatingScore++;
}
else
{
// Reset drift score to 0
}
The neat thing about if statements is that when you have an if else statement dealing with booleans, it assumes the else part is going to be the opposite. So for example if you have
if (boolean == true)
{
// Some code
}
else
{
// Some more code
}
it assumes the else will be else (boolean == false) so you technically, in this instance, don’t need it to be anything like else if (boolean == false)
You can further simplify it by saying if (carController.driftingNow) because that’s like saying if (true).