Increase the time in X seconds each time the score equals a multiple of 500

I have a variable that raises time for every 500 points of score.

For now I have a code that works perfectly, but I want simplify the code with just 5 or 6 lines, because this is a endless run game and I don´t want do this method with 100 if conditions.

My code is:

if (scoreNum.Equals (500)) {

			this.RaiseExtendPlay (60);
			extendedplay.extendedSource.Play ();
		}			

		if (scoreNum.Equals (1000)) {

			this.RaiseExtendPlay (60);
			extendedplay.extendedSource.Play ();
		}	

		if (scoreNum.Equals (1500)) {

			this.RaiseExtendPlay (60);
			extendedplay.extendedSource.Play ();
		}

		if (scoreNum.Equals (2000)) {

			this.RaiseExtendPlay (60);
			extendedplay.extendedSource.Play ();
		}

Basically

private int previousMultiplesOf500;
private int score;

void Update() {
    int currentMultiplesOf500 = score / 500;
    if ( previousMultiplesOf500 <  currentMultiplesOf500 ) {
 
             this.RaiseExtendPlay (60);
             extendedplay.extendedSource.Play ();
             previousMultiplesOf500 = currentMultiplesOf500;
    }        
}

Sorry for later answer. I was trying to solve another minor bugs.

This works perfectly.

Thanks :slight_smile: