25 lines
656 B
Markdown
25 lines
656 B
Markdown
|
# System
|
||
|
### Contents
|
||
|
[About](#About)
|
||
|
|
||
|
## About
|
||
|
The system runs operations that must be performed on its assoiciated components.
|
||
|
|
||
|
Typically, this is expected to be run every frame, though this is not a strict requirement.
|
||
|
|
||
|
Examples of the `system` include the `health_system`; which reads the value of the entitie's `health` component and ensures h > 0.
|
||
|
``` java
|
||
|
void health_system(){
|
||
|
for (i = 0; i < registeredComponents.size(); i++){
|
||
|
if (registeredComponents[i].health <= 0){
|
||
|
registeredComponents[i].dead = true;
|
||
|
if (registeredComponents[i].isPlayer){
|
||
|
GameOver();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
```
|
||
|
|
||
|
|