platformer
|
Custom update loop. More...
Public Member Functions | |
delegate void | TimeChanged (float timeScale) |
Time change callback More... | |
void | OnEnable () |
LazyInit More... | |
void | FixedUpdate () |
Run update loop More... | |
Static Public Member Functions | |
static long | GetCurrentFrame () |
Get current frame More... | |
static float | GetFixedDeltaTime () |
Get current delta More... | |
static int | GetFrameCount (float time) |
Time to frame conversion More... | |
static bool | Push (IUpdateEntity entity, int priority) |
Push a new entity to update loop More... | |
static int | IndexOf (IUpdateEntity entity) |
Index of given entity in the frameListeners More... | |
static bool | Remove (IUpdateEntity entity) |
Remove given entity from frameListeners More... | |
static float | GetCurrentDelta () |
Helper to get current delta, it's sent to PlatformerUpdate & LatePlatformerUpdate but could be useful if you don't want to foward it's value everywhere More... | |
static void | SetTimeout (Action callback, float timeout) |
Call given callback in given timeout if timeout is <= 0, will be called now. More... | |
static void | SetInterval (Action callback, float timeout) |
Call given callback in given timeout More... | |
static bool | ClearTimeout (Action callback) |
Remove once given callback More... | |
static Delay | GetDelay (float time) |
Create a new Delay (or reuse it) More... | |
static void | DisposeDelay (Delay d) |
Mark Delay to be reused More... | |
![]() | |
static void | ClearInstance () |
This method is for testing purposes only, you should not called it in your application More... | |
Public Attributes | |
bool | debug = false |
Create a debug UI More... | |
float | forceFixedDeltaTime = 0.0f |
Ignore Unity Time.fixedDeltaTime use this value this is meant for testing, because setting Time.fixedDeltaTime may mess your configuration More... | |
float | runningTime = 0 |
Time the app is running More... | |
long | frame = 0 |
Current frame More... | |
TimeChanged | onTimeScaleChanged |
notify when time is changed More... | |
Delay [] | freeDelays |
List of free delays More... | |
int | freeDelaysCount = 0 |
How many free delays are available More... | |
Delay [] | delays |
List of Delays in use More... | |
int | delaysCount = 0 |
How many Delays are in use More... | |
Protected Attributes | |
float | _timeScale = 1 |
Time scale More... | |
float | nextFrameTimeScale = 1 |
Time Scale in the next frame This variable is for consistency, when anybody change timeScale the change is queued until next FixedUpdate More... | |
Properties | |
float | timeScale [get, set] |
Time Scale More... | |
![]() | |
static T | instance [get] |
Singleton instance retrieval More... | |
Additional Inherited Members | |
![]() | |
static T | _instance |
Singleton instance More... | |
Custom update loop.
The purpose behind this class/style is to be precise about the update order of all entities.
Also handle Timeout Actions, do not use corountines.
NOTE Use a sorted array based on the priorities defined at Configuration
NOTE executionOrder should be -50
NOTE Do not call UpdateManager at Awake
|
inlinestatic |
Remove once given callback
|
inlinestatic |
Mark Delay to be reused
|
inline |
Run update loop
First call PlatformerUpdate
Then call LatePlatformerUpdate
NOTE FixedUpdate can be called multiple times each frame
|
inlinestatic |
Helper to get current delta, it's sent to PlatformerUpdate & LatePlatformerUpdate but could be useful if you don't want to foward it's value everywhere
|
inlinestatic |
Get current frame
|
inlinestatic |
Create a new Delay (or reuse it)
|
inlinestatic |
Get current delta
|
inlinestatic |
Time to frame conversion
NOTE you should listen to timeScale changes...
|
inlinestatic |
Index of given entity in the frameListeners
>= 0 if found (index). -1 if not found
|
inline |
LazyInit
|
inlinestatic |
Push a new entity to update loop
|
inlinestatic |
Remove given entity from frameListeners
If it was removed
|
inlinestatic |
Call given callback in given timeout
NOTE Do not use corountines because the can't hotswap Also corountines don't know if you modify timeScale this do.
|
inlinestatic |
Call given callback in given timeout if timeout is <= 0, will be called now.
NOTE Do not use corountines because the can't hotswap Also corountines don't know if you modify timeScale this do.
delegate void UnityPlatformer.UpdateManager.TimeChanged | ( | float | timeScale | ) |
Time change callback
|
protected |
Time scale
bool UnityPlatformer.UpdateManager.debug = false |
Create a debug UI
Delay [] UnityPlatformer.UpdateManager.delays |
List of Delays in use
int UnityPlatformer.UpdateManager.delaysCount = 0 |
How many Delays are in use
float UnityPlatformer.UpdateManager.forceFixedDeltaTime = 0.0f |
Ignore Unity Time.fixedDeltaTime use this value
this is meant for testing, because setting Time.fixedDeltaTime may mess your configuration
long UnityPlatformer.UpdateManager.frame = 0 |
Current frame
Delay [] UnityPlatformer.UpdateManager.freeDelays |
List of free delays
int UnityPlatformer.UpdateManager.freeDelaysCount = 0 |
How many free delays are available
|
protected |
Time Scale in the next frame
This variable is for consistency, when anybody change timeScale the change is queued until next FixedUpdate
TimeChanged UnityPlatformer.UpdateManager.onTimeScaleChanged |
notify when time is changed
float UnityPlatformer.UpdateManager.runningTime = 0 |
Time the app is running
|
getset |
Time Scale
1 fast motion
< 1 slow motion