-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
431674e
commit 5045b09
Showing
7 changed files
with
69 additions
and
15 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { setRenderStateDirty } from "../systems/RenderSystem"; | ||
|
||
const DATA: Array<boolean> = []; | ||
|
||
export function setToBeRemoved(entityId: number, value: boolean) { | ||
DATA[entityId] = value; | ||
setRenderStateDirty(); | ||
} | ||
|
||
export function isToBeRemoved(entityId: number): boolean { | ||
return !!DATA[entityId]; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { removeEntity } from "../Entity"; | ||
import { executeFilterQuery } from "../Query"; | ||
import { isToBeRemoved } from "../components/ToBeRemoved"; | ||
|
||
const entityIds: number[] = []; | ||
export function listEntitiesToBeRemoved(): ReadonlyArray<number> { | ||
entityIds.length = 0; | ||
return executeFilterQuery(isToBeRemoved, entityIds); | ||
} | ||
|
||
export function RemoveEntitySystem() { | ||
for (const entityId of listEntitiesToBeRemoved()) { | ||
removeEntity(entityId); | ||
} | ||
} |
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