Skip to content

Add Initialize() Finalize() Methods in the System #24

Description

@PhoenixICE

Allow systems to call an Initialize Method and a Finalize Method aside from just having an Update Method.

The initialize method allows you to contain any initialisation requirements within the system instead of when instantiating the system:

EG:

var fooSystem = new FooSystem(gameRunner);
var entity = gameRunner.CreateEntityAsync();
fooSystem.RegisterComponentAsync(entity);

vs

public class FooSystem : BaseSystemInterface
{
    //add boilerplate etc...
    public async Task Initialize(GameRunner gameRunner)
    {
       var entity = gameRunner.CreateEntityAsync();
       this.RegisterComponentAsync(entity);
    }
}

The Finalize Method would allow you setup the system in a way that it can tear itself down of anything that needs to be cleared between new games (ie/start game -> Initialize -> end game -> Finalize -> new game -> Initialize etc..)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature RequestA feature that has been requested by a user or maintainer of the engine.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions