Table of Contents

Class ExtensionSystem

Namespace
NominalSystems.Universe
Assembly
NominalSystems.Universe.dll

[Nominal] The extension system is able to handle custom ticking functionality for use with the API and any other form. It just enables the ability to tick at a specific interval.


public class ExtensionSystem : UniverseSystem
Inheritance
ExtensionSystem
Extension Methods

Constructors

ExtensionSystem()

Default constructor

protected ExtensionSystem()

Methods

AddBehaviour(Type, UniverseObject?)

Attempts to add a new behaviour to the simulation. This will take in a type and create a new behaviour of that type. The behaviour will be parented to the parent, if provided. If the parent is null, then the behaviour will be added to the root level of the simulation.

public UniverseBehaviour? AddBehaviour(Type type, UniverseObject? parent = null)

Parameters

type Type

The type of behaviour to add

parent UniverseObject

The parent of the behaviour to add

Returns

UniverseBehaviour

The behaviour that was created, if it was created

AddObject(Type, UniverseObject?)

Attempts to add a new object to the simulation. This will take in a type and create a new object of that type. The object will be parented to the parent, if provided. If the parent is null, then the object will be added to the root level of the simulation.

public UniverseObject? AddObject(Type type, UniverseObject? parent = null)

Parameters

type Type

The type of object to add

parent UniverseObject

The parent of the object to add

Returns

UniverseObject

The object that was created, if it was created

GetRootBehaviours(UniverseObject?)

Returns all universe behaviours in the simulation that are parented to the given object. If the parent is null, then all root-level behaviours are returned.

public UniverseBehaviour[] GetRootBehaviours(UniverseObject? parent = null)

Parameters

parent UniverseObject

The parent to check

Returns

UniverseBehaviour[]

The list of all behaviours parented

GetRootObjects(UniverseObject?)

Returns all universe objects in the simulation that are parented to the given object. If the parent is null, then all root-level objects are returned.

public UniverseObject[] GetRootObjects(UniverseObject? parent = null)

Parameters

parent UniverseObject

The parent to check

Returns

UniverseObject[]

The list of all objects parented

GetSimulationTime()

Returns the simulation time in seconds

public double GetSimulationTime()

Returns

double

[s] The current simulation time

GetState()

Returns the current simulation state as a JSON object

public JObject GetState()

Returns

JObject

The state of the simulation

InitializeSimulation()

Initializes the simulation by updating the universe event controller. This will ensure that the simulation is correctly initialized and an update step is called on all components for the purpose of the saving and loading system.

public void InitializeSimulation()

SetState(JObject)

Sets the simulation state from a JSON object

public bool SetState(JObject state)

Parameters

state JObject

The state of the simulation

Returns

bool

A successful load

TickIterations(int, double)

Ticks the simulation with a certain number of iterations safely, ensuring that it does not take too long to complete. It will also return the number of iterations completed.

public int TickIterations(int iterations = 1, double step = 0.1)

Parameters

iterations int

The desired number of iterations

step double

[s] The step-size of the simulation tick

Returns

int

The number of iterations actually completed