86 lines
2.2 KiB
Markdown
86 lines
2.2 KiB
Markdown
*| [JavaECS](../../README.md) | [docs](../overview.md) | [system](./dir.md) | SystemManager[]().md*
|
|
# System Manager
|
|
| **In this Section** |
|
|
|-|
|
|
| [About](#about) |
|
|
| [Implementation](#implementation) |
|
|
| [Constructors](#constructors) |
|
|
| [Methods](#methods) |
|
|
| [Fields](#fields) |
|
|
| [Examples](#examples)|
|
|
| [Notes](#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](./ECSSystem.md). Using the object reference, a system can be invoked at any time.
|
|
|
|
See [SystemManager.java](/BrychanD/JavaECS/src/branch/master/javaecs/src/main/java/nz/ac/massey/javaecs/SystemManager.java) for the full implementation.
|
|
|
|
## Constructors
|
|
Default constructor
|
|
``` java
|
|
public SystemManager(){}
|
|
```
|
|
|
|
<br>
|
|
|
|
## Methods
|
|
|
|
### entityDestroyed
|
|
``` java
|
|
protected void entityDestroyed(int entity);
|
|
```
|
|
Signals the SystemManager that an entity was destroyed. Removes the entity from each system's tracked entities
|
|
|
|
<br>
|
|
|
|
### entitySignatureChanged
|
|
``` java
|
|
protected void entityRegistrationsChanged(int entity, BitSet entityRegistrations);
|
|
```
|
|
Signals the SystemManager that an entity had its registrations changed; iterates through each system validating the entities list
|
|
|
|
<br>
|
|
|
|
### registerSystem
|
|
``` java
|
|
protected boolean registerSystem(Type systemType, ECSSystem system);
|
|
```
|
|
Registers the specified system name and system reference to this manager.
|
|
|
|
*adds a `systemType:system` pair to [systems](#systems)*
|
|
|
|
*adds a `systemType:new BitSet()` pair to [registrationSignatures](#registrationSignatures)*
|
|
|
|
<br>
|
|
|
|
### setSignature
|
|
``` java
|
|
protected void setRegistrationSignature(Type systemType, BitSet registrations);
|
|
```
|
|
Sets the registrations the system requires
|
|
|
|
<br>
|
|
|
|
## Fields
|
|
### registrationSignatures
|
|
``` java
|
|
private Map<Type, BitSet> registrationSignatures = new HashMap<>()
|
|
```
|
|
The mapped list of required registrations
|
|
|
|
<br>
|
|
|
|
### systems
|
|
``` java
|
|
private Map<Type, ECSSystem> systems = new HashMap<>();
|
|
```
|
|
The mapped list of system instances
|
|
|
|
<br>
|
|
|