Hello, I have developed an application where I capture the pictures of a camera, so in specific cases I need the objects to slow down (almost paused) for a period of time and then they will return to normal speed and so on. He tried to use the function Time.timeScale = 0 and Time.timeScale = 1 but I don’t get it to be something periodic, the code I have is:
bool StepSimulator = false; //indicator that status game
float currentTime = 0;
float maxTime = 2; //Tiem to paused an normaly game velocity
currentTime += Time.deltaTime;
if (Time.timeScale == 1 && currentTime >= maxTime )
{
currentTime = 0;
StepSimulator = true;
Time.timeScale = 0; //velocity = 0 --> pause
}
else if (Time.timeScale == 0 && currentTime >= maxTime)
{
currentTime = 0;
// si la velocidad es 0 es igual a una pausa
StepSimulator = false;
Time.timeScale = 1; // velocity normal back a 1
}
la idea es:
-paused game2 seconds
-normal game 2 seconds
-paused game 2 seconds
-normal game 2 seconds
…
…
. así sucesivamente