Extend nexus with naive entity with component collection creation
This commit is contained in:
parent
9f95889439
commit
09bfa595c3
|
|
@ -21,6 +21,13 @@ extension Nexus {
|
|||
return newEntity
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
public func createEntity<C>(with components: C) -> Entity where C: Collection, C.Element == Component {
|
||||
let entity = self.createEntity()
|
||||
components.forEach { entity.assign($0) }
|
||||
return entity
|
||||
}
|
||||
|
||||
/// Number of entities in nexus.
|
||||
public var numEntities: Int {
|
||||
entityStorage.count
|
||||
|
|
|
|||
Loading…
Reference in New Issue