Nebula
Loading...
Searching...
No Matches
Nebula.Game.TimeManager Class Referencesealed

Detailed Description

The mirror of the engine's time sources.

The engine has authority over the time, and this holds what the last sync saw, so a read is a field read rather than a call through the api.

Public Member Functions

TimeSource Get (uint hash)
 The mirror for a time source, or null when the runtime has not seen one with this hash.
TimeSource Create (uint hash, double fixedFrameTime, int maxStepsPerFrame=5)
 Create a time source in the engine and mirror it here.
void Sync ()
 Refresh the mirror from the engine.

Properties

static TimeManager Instance [get]
 Returns the time manager singleton instance.
float GlobalTimeFactor [get, set]
 The global time scale.
TimeSource System [get]
TimeSource Gameplay [get]
TimeSource Input [get]

Private Member Functions

 TimeManager ()

Static Private Member Functions

static TimeManager ()

Private Attributes

readonly TimeSourceSnapshot[] buffer
readonly GCHandle handle
readonly Dictionary< uint, TimeSource > sources
float globalTimeFactor

Static Private Attributes

const int MaxSources = 32
static readonly TimeManager instance = new TimeManager()

Constructor & Destructor Documentation

◆ TimeManager() [1/2]

Nebula.Game.TimeManager.TimeManager ( )
inlinestaticprivate

◆ TimeManager() [2/2]

Nebula.Game.TimeManager.TimeManager ( )
inlineprivate

Member Function Documentation

◆ Create()

TimeSource Nebula.Game.TimeManager.Create ( uint hash,
double fixedFrameTime,
int maxStepsPerFrame = 5 )
inline

Create a time source in the engine and mirror it here.

Asking for one that already exists gives the mirror for it.

◆ Get()

TimeSource Nebula.Game.TimeManager.Get ( uint hash)
inline

The mirror for a time source, or null when the runtime has not seen one with this hash.

◆ Sync()

void Nebula.Game.TimeManager.Sync ( )
inline

Refresh the mirror from the engine.

Called once per frame at the beginning of the frame, after the engine has advanced the sources, so the values are this frame's and the fixed steps have not been consumed yet.

Member Data Documentation

◆ buffer

readonly TimeSourceSnapshot [] Nebula.Game.TimeManager.buffer
private

◆ globalTimeFactor

float Nebula.Game.TimeManager.globalTimeFactor
private

◆ handle

readonly GCHandle Nebula.Game.TimeManager.handle
private

◆ instance

readonly TimeManager Nebula.Game.TimeManager.instance = new TimeManager()
staticprivate

◆ MaxSources

const int Nebula.Game.TimeManager.MaxSources = 32
staticprivate

◆ sources

readonly Dictionary<uint, TimeSource> Nebula.Game.TimeManager.sources
private

Property Documentation

◆ Gameplay

TimeSource Nebula.Game.TimeManager.Gameplay
get

◆ GlobalTimeFactor

float Nebula.Game.TimeManager.GlobalTimeFactor
getset

The global time scale.

This should be used sparingly; a source's own factor is usually what you want.

◆ Input

TimeSource Nebula.Game.TimeManager.Input
get

◆ Instance

TimeManager Nebula.Game.TimeManager.Instance
staticget

Returns the time manager singleton instance.

◆ System

TimeSource Nebula.Game.TimeManager.System
get

The documentation for this class was generated from the following file:
  • /github/workspace/code/addons/nsharp/NebulaEngine/engine/TimeManager.cs