Class UniverseEvent
- Namespace
- NominalSystems.Universe
- Assembly
- NominalSystems.Universe.dll
[Nominal] The universe event object is the base object for all universe event types. This includes Universe behaviours, objects, models and systems. This handles the functionality of ticking through the objects as well as managing the event lifetimes.
public abstract class UniverseEvent : Simulation.Object
- Inheritance
-
UniverseEvent
- Derived
- Extension Methods
Constructors
UniverseEvent()
Default constructor
protected UniverseEvent()
Fields
IsEnabled
True if the object is currently enabled.
public bool IsEnabled
Field Value
Owner
The owner of this object. This is used for serialization purposes and should not be edited.
[Hidden]
public UniverseEvent? Owner
Field Value
Properties
HasStarted
True if the object has invoked 'OnBegin' function.
[Hidden]
public bool HasStarted { get; }
Property Value
IsRunning
True if the object is running.
[Hidden]
public bool IsRunning { get; }
Property Value
Methods
AddObject<T>()
Adds a new simulation object with the specified type.
protected T AddObject<T>() where T : Simulation.Object
Returns
- T
Type Parameters
T
GetMetadata()
Returns the simulation object's metadata.
protected JObject GetMetadata()
Returns
- JObject
Exceptions
GetMetadata(string)
Returns the simulation object's metadata at the specified key.
protected JToken? GetMetadata(string key)
Parameters
key
string
Returns
- JToken
Exceptions
GetSystem<T>()
Returns a simulation system on the current object, which will fetch the system from the simulation.
public T GetSystem<T>() where T : UniverseSystem
Returns
- T
A reference to the simulation system
Type Parameters
T
The simulation system type to fetch
IsA<T>()
Returns true if the current object is of the specified type.
public bool IsA<T>() where T : UniverseEvent
Returns
Type Parameters
T
The universe type
OnBegin(double)
Called when the object is beginning ticking for the first time. This is when the simulation calls the very first tick and will run before the update call.
protected virtual void OnBegin(double time)
Parameters
time
double[s] Current time of the simulation before the tick
OnCreate()
Called when the object is created from the controller and has been attached to the parent object. By this point, it has been registered to the simulation and will run after the constructor.
protected virtual void OnCreate()
OnFinish(double)
Called when the object is deleted from the simulation and can handle any cleanup of variables.
protected virtual void OnFinish(double time)
Parameters
time
double[s] The current clock time when deleted
OnLoad(double)
Called after all of the data has been loaded from a save state on this object. This enables any post-load operations to be performed and extra data to be loaded from the metadata.
protected virtual void OnLoad(double time)
Parameters
time
double[s] The current clock time of the simulation
OnPreUpdate(double, double)
Called when the object is about to be updated, which will be called before any children or behaviours are updated. This is useful for any pre-update calculations that need to be done.
[IgnoreUpdate]
protected virtual void OnPreUpdate(double time, double step)
Parameters
time
double[s] Current time of the simulation before the update
step
double[s] The time-step to update during this tick
OnSave()
Called before the object is saved into the save state. This ensures that any additional metadata can be saved on the object before it is automatically serialized.
protected virtual void OnSave()
OnUpdate(double, double)
Called when the object should update from the simulation tick. This will take in a time and a step, where the time is the time of the clock before updating the object.
[IgnoreUpdate]
protected virtual void OnUpdate(double time, double step)
Parameters
time
double[s] Current time of the simulation before the update
step
double[s] The time-step to update during this tick
SetMetadata(JObject)
Sets the simulation object's metadata.
protected void SetMetadata(JObject value)
Parameters
value
JObject
Exceptions
SetMetadata(string, JToken?)
Sets the simulation object's metadata at the specified key.
protected void SetMetadata(string key, JToken? value)
Parameters
key
stringvalue
JToken