Answers for "Increasing score based on speed"
http://answers.unity.com/questions/1363828/increasing-score-based-on-speed.html
The latest answers for the question "Increasing score based on speed"Answer by Major
http://answers.unity.com/answers/1363908/view.html
What if you plotted an equation that returned the time interval between each point assignment?
Your independent variable being speed (x-axis) and your dependent variable being the time interval (y-axis). If you plot the function
y = -0.1x + 1.1
you can return any time interval value you want between 1 and 9. Then you plug in this result into your WaitForSeconds to achieve the appropriate wait time. This could look something like this:
float speed = Mathf.Truncate(objSpeed); //Edit: needed so that you always test an integer
if (speed >= 1 && speed <= 9) {
waitTime = -0.1 * speed + 1.1;
} else if (speed > 9) {
waitTime = 0.2f;
} else if (speed < 1) {
waitTime = Mathf.Infinity;
}
By truncating the objSpeed and plugging in the result, you can setup these boundaries.
It's also important to note that **waitTime** should be a global variable to ensure that it's value carries from previous frames.
I hope that this helps to answer your question. Sorry it was so long, but I wanted to try to build something from the ground up with an alternative approach. This code is untested, but I hope the theory at least comes across if nothing else. I hope this helps!Sat, 10 Jun 2017 19:12:47 GMTMajor