81 lines
1.8 KiB
Markdown
81 lines
1.8 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.
|
|
|
|
## Constructors
|
|
Default constructor
|
|
``` java
|
|
public SystemManager(){}
|
|
```
|
|
<br>
|
|
|
|
## Methods
|
|
|
|
### entityDestroyed
|
|
``` java
|
|
public void entityDestroyed(int entity);
|
|
```
|
|
Removes the specified entity from every system, if it was associated
|
|
|
|
<br>
|
|
|
|
### entitySignatureChanged
|
|
``` java
|
|
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.
|
|
|
|
<br>
|
|
|
|
### registerSystem
|
|
``` java
|
|
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](#systems)*
|
|
|
|
*and a `systemName:new BitSet()` pair to [signatures](#signatures)*
|
|
|
|
<br>
|
|
|
|
### setSignature
|
|
``` java
|
|
public void setSignature(String system, BitSet registrations);
|
|
```
|
|
Sets the required signature of the `system`
|
|
|
|
<br>
|
|
|
|
## Fields
|
|
### signatures
|
|
``` java
|
|
Map<String, BitSet> signatures = new HashMap<>();
|
|
```
|
|
|
|
<br>
|
|
|
|
### systems
|
|
``` java
|
|
Map<String, ECSSystem> systems = new HashMap<>();
|
|
```
|
|
|
|
<br>
|
|
|