I have spent almost my entire life in programming using scripting languages. They work mostly in compiled languages. If you're not familiar with the difference, for the purposes of this discussion scripting languages you can write the code and immediately run it. Compiled languages you have to compile it before you can run it. Compiling can take 10 or 20 minutes, up to an hour on very large projects. As such testing little things as you go would be quite time consuming.
So I had a very strange feeling when I just programmed a non-trivial addition to the to the path finding handler and it worked. Now its only 9 lines of code (not counting declaration statements), lets not get to crazy but I thought it out, had all the variables figured out before writing it. Then just wrote it. Done. I'm sure this sounds silly to anyone who isn't me right now. I might even look back at this and find it silly sounding.
But I feel, at least for the moment, like I might actually know what I'm doing instead of just testing my way through everything that I do. It feels good.
For anyone interested, here is the code that 'just worked' for me.
if (distanceToTarget >= maxRecheckDistance)
recheckDuration = maxRecheckDuration;
else if (distanceToTarget <= minRecheckDistance)
recheckDuration = minRecheckDuration;
else
{
//This gets the percentage of the way between min and max distance the gameObject is from target.
//Then scales it by the difference between min and max duration, then adds min
//I should really break this down into multiple lines for clarity...
recheckDuration = (maxRecheckDuration - minRecheckDuration) *
((distanceToTarget - minRecheckDistance) / (maxRecheckDistance - minRecheckDistance)) + minRecheckDuration;
}
if (recheckTimer > recheckDuration)
recheckTimer = recheckDuration;