Problem with increasing difficulty system

So I have been trying to make difficulty increase in my game by making enemy spawning cooldown decrease with waves something like this “currentcooldown = cooldown - wave / 15” in update, it worked but I wanted to make so if cooldown would decrease under 2 it would start decreasing slower and thats where I got stuck…

I tried to make it so cooldown would decrease to 2 so it wouldn’t just jump when waves are getting divided by a larger number but then it would just hop from 2 to 1 at the moment new wave came… this is how I tried to do it:

"
if(colShow >= 2)
{
colShow = cooldown - GameSystem.stats.waveCount / 15f;
Debug.Log(cooldown - GameSystem.stats.waveCount / 15f);
}
else if(colShow >= 1.2f)
{
cooldown = 2f;
colShow = cooldown - GameSystem.stats.waveCount / 35f;
}

if (colShow < 0.45f)
{
colShow = 0.45f;
}
"
so I have no idea on how to fix it.

Let me suggest that you don’t think of it (for the moment) as a cooldown value or any other “thing” but just your need for a decreasing (or increasing) value based upon some criteria. If you think of it that way you figure out you need a GetCooldown() method (or something like it). Have it return a value of 1f for now. And you need some small test method TestCooldown() that calls it and logs the value. Then you modify the code in GetCooldown until you see values in the range you are looking for. Only then do you merge this into your game code.

Clearly returning 1f won’t work and it depends upon some conditions so you add them as parameters to the GetCooldown method and adjust the algorithm as needed. A problem people often run into is trying adjust algorithms while coding in the game. They have to watch to see what effect their change has “in the game” when you really just want to know the numbers return in the pattern you want. Isolate that code until it works.

I for instance can’t tell what colShow or cooldown or waveCount is or where they come from and we should care, pass the values in if they are needed don’t rely on them existing and being visible.