Class SystemGroup
- Namespace
- KeenEyes
- Assembly
- KeenEyes.Abstractions.dll
A group of systems that execute together. Useful for organizing systems by phase or feature.
public class SystemGroup : ISystem, IDisposable
- Inheritance
-
SystemGroup
- Implements
- Inherited Members
Examples
var physicsGroup = new SystemGroup("Physics")
.Add<BroadphaseSystem>(order: 0)
.Add<NarrowphaseSystem>(order: 10)
.Add<SolverSystem>(order: 20);
world.AddSystemGroup(physicsGroup, SystemPhase.FixedUpdate);
Remarks
System groups allow organizing multiple systems that execute as a unit. Systems within a group are sorted by order value and executed sequentially.
Groups can be nested within other groups for hierarchical organization.
Constructors
SystemGroup(string)
A group of systems that execute together. Useful for organizing systems by phase or feature.
public SystemGroup(string name)
Parameters
namestringThe name of the group.
Examples
var physicsGroup = new SystemGroup("Physics")
.Add<BroadphaseSystem>(order: 0)
.Add<NarrowphaseSystem>(order: 10)
.Add<SolverSystem>(order: 20);
world.AddSystemGroup(physicsGroup, SystemPhase.FixedUpdate);
Remarks
System groups allow organizing multiple systems that execute as a unit. Systems within a group are sorted by order value and executed sequentially.
Groups can be nested within other groups for hierarchical organization.
Properties
Enabled
Gets or sets whether this system is enabled. Disabled systems are skipped during world updates.
public bool Enabled { get; set; }
Property Value
Name
Gets the name of this system group.
public string Name { get; }
Property Value
Systems
Gets the systems in this group.
public IReadOnlyList<ISystem> Systems { get; }
Property Value
Remarks
Systems are returned in their current order (may not be sorted if modifications have been made since last Update call).
Methods
Add(ISystem, int)
Adds a system instance to this group with specified execution order.
public SystemGroup Add(ISystem system, int order = 0)
Parameters
systemISystemThe system instance to add.
orderintThe execution order within the group. Lower values execute first. Defaults to 0.
Returns
- SystemGroup
This group for method chaining.
Remarks
Use this overload when you need to pass a pre-configured system instance or a system that requires constructor parameters.
Add<T>(int)
Adds a system to this group with specified execution order.
public SystemGroup Add<T>(int order = 0) where T : ISystem, new()
Parameters
orderintThe execution order within the group. Lower values execute first. Defaults to 0.
Returns
- SystemGroup
This group for method chaining.
Type Parameters
TThe system type to add.
Remarks
Systems within a group are sorted by order value. Systems with lower order values execute first. Systems with the same order maintain stable relative ordering.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Dispose(bool)
Releases resources used by this system group.
protected virtual void Dispose(bool disposing)
Parameters
disposingboolTrue if called from Dispose(), false if called from finalizer.
GetSystem<T>()
Gets a system of the specified type from this group.
public T? GetSystem<T>() where T : class, ISystem
Returns
- T
The system instance, or null if not found.
Type Parameters
TThe type of system to retrieve.
Initialize(IWorld)
Called when the system is added to a world.
public void Initialize(IWorld world)
Parameters
worldIWorldThe world this system operates on.
Update(float)
Called each frame/tick to update the system.
public void Update(float deltaTime)
Parameters
deltaTimefloatTime elapsed since the last update in seconds.