I have 2 progress bars. During the “Turnstate.Wait” is when they fill. Once filled, they switch to “TurnState.Ready”. Once a choice is made they switch to “TurnState.Animate” and they the cycle repeats.
What I want to do is make it so that whatever bar fills first and enters “TurnState.Ready”, the progress of the other bar is halted until winning bar returns to “TurnState.Wait”
How would I go about that? I thinking something like "if ( cooldown >= waittime).(something goes here)…;
Well, you can change the relationship between real-world time and “game time” via Time.timeScale. If you’re going to mess with that, though, you need to be very careful about which things in your game use which kind of time; for instance, if you have animations in your UI that are based on game time instead of real time, then setting timeScale to 0 will make your UI unusable.
If you just want to stop one specific progress bar, it might be smarter to alter whatever code you are using for that progress bar to check the TurnState and just ignore the passage of time if it’s not set to Wait.
One approach would be to add a line at the very top of the function that says something like
if (currentStateR != TurnState.WAIT) return;
That will skip the entire function if you’re in any state other than WAIT.
But you might want to be able to run the code that updates the appearance of the progress bar even if it’s not moving (e.g. if you change the value in some unusual way, or if you need to “reset” after some other change). So a more robust option might be to to make only the first line conditional (where you update cooldownL), and run the rest of the code as normal. So it might look something like:
Thank you so much man. Such a duuuh moment. I don’t know why that did not come to me, but for every bit of help I get here I continue to grow as programmer. Thank you, thank you thank you.