Make EntitiesIterator available

This commit is contained in:
Christian Treffs 2020-10-15 22:10:43 +02:00
parent 6779af105e
commit a0d3f443f7
No known key found for this signature in database
GPG Key ID: 49A4B4B460BE3ED4
1 changed files with 7 additions and 0 deletions

View File

@ -33,6 +33,13 @@ extension Nexus {
componentIdsByEntity.keys.count
}
/// Creates an iterator over all entities in the nexus.
///
/// Entity order is not guaranteed to stay the same over iterations.
public func makeEntitiesIterator() -> EntitiesIterator {
EntitiesIterator(nexus: self)
}
public func exists(entity entityId: EntityIdentifier) -> Bool {
componentIdsByEntity.keys.contains(entityId)
}