I would do something like this:
var scoreMultiplier = 5;
function Start () {
InvokeRepeating( "DecreaseMultiplier", 30 , 30);
//You could easily set this up as a coroutine if you wanted variable times.
}
function DecreaseMultiplier () {
scoreMultiplier--;
//Possibly clamp at 1pt.
}
function OnCollisionEnter () {
score += scoreMultiplier;
//basically the same as yours, just with a variable.
}
↧