Mathf.Repeat How to check whether it's repeated

value = Mathf.Repeat((float)ts.TotalMilliseconds/RefreshTime, 1);

Hi, how to check if the value is repeated from 1.0 back to 0.0? So I can do something like eliminate enemies in the scene every time.

I’ve tried check the value like if value is equal to 0.0, however it skipped and move on to value like 0.102…

Any suggestion? Thank you =))

You save the value in the previous frame. So at the top of the file you would have:

 private float prevVal = 0.0;

Then in the code you do:

 value = Mathf.Repeat((float)ts.TotalMilliseconds/RefreshTime, 1);
 if (value < prevVal) {
     Debug.Log("I'm starting a new cycle");
 }
 prevVal = value;