-
Notifications
You must be signed in to change notification settings - Fork 14
Systems
Eldar Muradov edited this page Jul 25, 2024
·
2 revisions
If you want to create a system, you should derrive from interface IESystem or interface IEntitySystem.
interface IESystem provides ESystemPriority Priority { get; } and void Update(float dt) to manage system's pipeline.
interface IEntitySystem derrives interface IESystem and also gives you List<EEntity> Entities { get; } property to own some collection of entities.
Example:
namespace EraEngine;
public class BackgroundServiceSystem : IESystem
{
public ESystemPriority Priority { get; }
public BackgroundServiceSystem()
{
Priority = ESystemPriority.Low;
}
public void Update(float dt)
{
}
}
All user's systems are automatically registered over the reflection mechanism. But to add sustem to the working pipeline you should add it to system configuration json file. If you want to clear all systems or re-register your system you can do it as follows:
ESystemManager.RegisterSystem<BackgroundServiceSystem>(); // Implicit registration
ESystemManager.ReleaseSystems() // Release all systems