Cleanup and document family API
This commit is contained in:
parent
998ce2583c
commit
849110f8cc
|
|
@ -17,14 +17,16 @@ public struct Family<R> where R: FamilyRequirementsManaging {
|
||||||
nexus.onFamilyInit(traits: traits)
|
nexus.onFamilyInit(traits: traits)
|
||||||
}
|
}
|
||||||
|
|
||||||
@inlinable public var memberIds: UnorderedSparseSet<EntityIdentifier, EntityIdentifier.Idx> {
|
@inlinable var memberIds: UnorderedSparseSet<EntityIdentifier, EntityIdentifier.Idx> {
|
||||||
nexus.members(withFamilyTraits: traits)
|
nexus.members(withFamilyTraits: traits)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the number of family member entities.
|
||||||
@inlinable public var count: Int {
|
@inlinable public var count: Int {
|
||||||
memberIds.count
|
memberIds.count
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// True if this family has no members; false otherwise.
|
||||||
@inlinable public var isEmpty: Bool {
|
@inlinable public var isEmpty: Bool {
|
||||||
memberIds.isEmpty
|
memberIds.isEmpty
|
||||||
}
|
}
|
||||||
|
|
@ -55,7 +57,7 @@ extension Family: Equatable {
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Family: Sequence {
|
extension Family: Sequence {
|
||||||
__consuming public func makeIterator() -> ComponentsIterator {
|
public func makeIterator() -> ComponentsIterator {
|
||||||
ComponentsIterator(family: self)
|
ComponentsIterator(family: self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue