glue-reference-screens-pauseadjustedsecondssince
Introduction
The PauseAdjustedSecondsSince method returns the number of seconds that have passed since the argument time, not including time spent paused. This method is similar to the TimeManager.SecondSince method, however it does not include the amount of time that the current Screen has spent paused. This method is purely a convenience method - it does not provide any functionality beyond subtracting the current time from a given time and returning the result; however it may be more expressive to use in certain situations improving the readability of code. For information on pause-adjusted timing, see the PauseAdjustedCurrentTime page.
Code Example - Performing some action after a set amount of time
You can use PauseAdjustedSecondsSince to see how long the Screen has been around and compare it to a fixed number. To check if the Screen has been around for a certain amount of time:
Code Example - Performing a repeating action
PauseAdjustedSecondsSince can be used to perform an action after a certain amount of time has passed. The following code shows how to perform an action every 5 seconds:
Code Example - Displaying time Screen has been alive
The following code shows how to create a countdown timer. It assumes that your Screen has a valid Text object called CountDownText
Code Example - Performing Timed Logic in Entities
Entities can limit the frequency of an action (such as firing a bullet) using the PauseAdjustedSecondsSince method. The following code limits shooting bullets using the SecondsBetweenShots variable:
Last updated