Skip to content

Systems

Eldar Muradov edited this page Feb 8, 2024 · 2 revisions

Creating system

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)
    {
    }
}

Registering a system

All user's systems are automatically registered over the reflection mechanism. 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
Clone this wiki locally