Created
May 10, 2016 06:17
-
-
Save ooflorent/6926ac7345d430c8556c0576d4d29581 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const eventBus = new EventEmitter() | |
function someSystem() { | |
for (const entity of em.query(Timer)) { | |
const {delay} = entity.get(Timer) | |
if (delay <= 0) { | |
// Remove `Timer` component… | |
entity.remove(Timer) | |
// …then dispatch an event | |
eventBus.emit("componentRemoved", {entity}) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment