import { Query , QueryBuilder , QueryPredicate } from './Query' ; import { Entity } from './Entity' ; import { ReactionSystem } from './ReactionSystem' ; example export abstract class IterativeSystem extends ReactionSystem { private _removed : boolean = false ; protected constructor ( query ) { super ( query ) ; } public update ( dt ) { this . updateEntities ( dt ) ; } public onAddedToEngine ( ) { this . _removed = false ; super . onAddedToEngine ( ) ; } public onRemovedFromEngine ( ) { this . _removed = true ; super . onRemovedFromEngine ( ) ; } protected updateEntities ( dt ) { for ( let entity of this . query . entities ) { if ( this . _removed ) return ; this . updateEntity ( entity , dt ) ; } } param entity param dt protected abstract updateEntity ( entity , dt ) ; }