EntityController
Manages a set of game systems that implement the ISystem
protocol and the Entity
objects that interact with those systems.
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
See more -
A struct containing the subscribable signals published by the controller.
Declaration
Swift
public var signals = Signals()
-
The designated initializer.
Declaration
Swift
public init()
-
Initializes parameters from a loaded
Config
object. You must callconfigure()
before any attempting to build anyEntity
objects, as the configuration contains the templates used to instantiate your entities.Declaration
Swift
public func configure(config:Config)
Parameters
config
a
Config
object containingEntity
templates -
Creates a new
Entity
from the configuration template named by thetemplate
argument. The entity’s components are all automatically instantiated and added to their respective systems.Declaration
Swift
public func createEntity(#template:String) -> Result<Entity.EntityID>
Parameters
template
The name of the template from which to instantiate the new
Entity
.Return Value
The
uuid
of the newEntity
. -
Adds the given entity to the controller and passes its components to their respective registered systems.
Declaration
Swift
public func addEntity (entity:Entity, withComponents components: [IComponent]) -> Result<Void>
-
Removes the entity with the given ID from the controller and from all registered systems that it interacts with.
Declaration
Swift
public func removeEntity(entityID:EntityID) -> Entity?
-
Returns an array containing all entities that contain all of the component types specified by the
components
bitmask.Declaration
Swift
public func entitiesWithAllComponents (components: Bitmask<Systems>) -> [Entity]
-
Returns an array containing all entities that contain any of the component types specified by the
components
bitmask.Declaration
Swift
public func entitiesWithAnyComponents (components: Bitmask<Systems>) -> [Entity]
-
Registers the provided system with the controller. All systems must be registered before any entities that use them are created.
Declaration
Swift
public func registerSystem(system:ISystem)
-
Unregisters the system with the given ID, if one exists.
Declaration
Swift
public func unregisterSystemWithID(systemID:Systems) -> ISystem?
Return Value
The unregistered system, or
nil
if none was found. -
Scene loop update method. Call this from your scene’s
update()
method. It updates all entities and systems that are currently registered with the controller.Declaration
Swift
public func update(currentTime:NSTimeInterval)