JavaECS-Docs/docs/system/SystemManager.md

1.8 KiB

| JavaECS | docs | system | SystemManager.md

System Manager

In this Section
About
Implementation
Constructors
Methods
Fields
Examples
Notes

About

The system manager class controls references to the systems.

Implementation

Before attempting to use a system, it must be registered.

Registration requires a call to registerSystem(String systemName, ECSSystem system), with params of the String name and a object reference of the ECSSystem. Using the object reference, a system can be invoked at any time.

Constructors

Default constructor

public SystemManager(){}

Methods

entityDestroyed

public void entityDestroyed(int entity);

Removes the specified entity from every system, if it was associated


entitySignatureChanged

public void entitySignatureChanged(int entity, BitSet entitySignature);

Checks the entity's new signature against the current registrations. Registers the entity if it wasn't previously registered, or removes it if it is no longer registered.


registerSystem

public boolean registerSystem(String systemName, ECSSystem system);

Registers the specified system name and system reference to this manager.

adds a systemName:system pair to systems

and a systemName:new BitSet() pair to signatures


setSignature

public void setSignature(String system, BitSet registrations);

Sets the required signature of the system


Fields

signatures

Map<String, BitSet> signatures = new HashMap<>();

systems

Map<String, ECSSystem> systems = new HashMap<>();