What I'm trying to do is very straightforward and easy, but I am wondering whether there is a more elegant solution.
Basically I have a game and I want the difficulty to increase the moment the score gets between 100 - 500, then increase once again when the score is between 500 - 1500, then again when the score is between 1500 - 3000. In total, the difficulty should increase 3 times.
I need to check:
- Whether I am in one of those ranges.
- Whether I already increased the score when I got in that range.
Here's what I've got.
bool Increased100500 = false;
bool Increased5001500 = false;
bool Increased15003000 = false;
void IncreaseScore()
{
if (Score >= 100 && Score <= 500 && !Increased100500)
{
Increase();
Increased100500 = true;
}
else if (Score >= 500 && Score < 1500 && !Increased5001500)
{
Increase();
Increased5001500 = true;
}
else if (Score >= 1500 && !Increased15003000)
{
Increase();
Increased15003000 = true;
}
}
LE: I should have mentioned that the method above is called multiple times per frame.
avoid answering questions in comments
. – ANeves yesterday