I created a small runner game , but I have a question.
I would like to increase the speed of my game as it progresses.
(Of course within reasonable limits ^^)
I have a lot of element that I need to configure with a global variable to do it.
And since I tinkered, to have satisfactory results.
Reconfigure the speeds of animations, elements, everything in sync…
In short, I wonder if it’s serious if I increase the time with Time.timeScale
.
Of course I correct my score watch at each level.
But it would be much easier to do it that way.
If some know : advantage / disadvantage, I listen to you ^^
I understand better why, everyone says to be careful to think carefully about your code, and to organize your project well, XDD :‘’'(
No answer, I hope I’m not doing something stupid, but I’m moving forward ^^.
So far everything seems to be working fine.
I had problems figuring out how to display my timer :
GetComponent<Text> ().text = string.Format("{0:00}:{1:00}:{2:00}",Mathf.Floor(elapsedTime/60),elapsedTime%60,(elapsedTime*100 )%100);
As the formulas this calculates on elapsedTime :
elapsedTime += Time. deltaTime/(Time. timeScale);
And my pause = timeScale = 0…
But I found the magic formula ^^
A little float, and I’m saved xDD
if (!playerControllerScript.gameOver)
{
if (!Pause.pause)
{
elapsedTimePause = elapsedTime;
elapsedTime += Time. deltaTime/(Time. timeScale);
}
else
{
elapsedTime = elapsedTimePause;
}
}