Midnight Blue Game and Engine
Public Member Functions | Properties | List of all members
MB2D.EntityComponent.EntityMap Class Reference

Maps entities, systems and components to one another and provides querying and updating access to all elements More...

Collaboration diagram for MB2D.EntityComponent.EntityMap:
Collaboration graph

Public Member Functions

 EntityMap ()
 Initializes a new instance of the T:MB2D.EntityComponent.EntityMap class. More...
 
 EntityMap (EntityMap map)
 Initializes a new instance of the T:MB2D.EntityComponent.EntityMap class. Uses an existing EntityMap to copy all registered systems and components as well as any persistant Entities. More...
 
void AddComponent< T > ()
 Registers a new component type to the EntityMap More...
 
void AddComponent (Type componentType)
 Registers a new component type to the EntityMap More...
 
void AddSystem< T > (params object[] args)
 Registers a new EntitySystem to the map More...
 
void AddEntity (Entity entity)
 Adds a created entity to this map More...
 
void UpdateEntityMask (Entity entity)
 Updates a specific entities component mask. Use after registering new components or systems. More...
 
void UpdateSystems (Entity entity)
 Updates each systems associated entity list, adding the specified Entity. Use after creating a new Entity and adding it manually More...
 
Entity CreateEntity (string tag="")
 Creates a new Entity with the given tag in this map. Auto-Registers the entity with all systems and updates its mask. More...
 
ulong GetComponentID< T > ()
 Gets the id of a specified component type if it exists. More...
 
EntitySystem GetSystem< T > ()
 Retrieves a pre-registered system from the map More...
 
List< EntityEntitiesWithComponent< T > ()
 
void Clear ()
 Clears all entities from this map except for any marked as persistant. More...
 
void Reset ()
 
void MakeBlueprint (string id, Action< Entity > buildFunction)
 
void UseBlueprint (string name, Entity entity)
 

Properties

Entity this[string key] [get]
 Gets the T:MB2D.EntityComponent.Entity with the specified tag if it exists; null otherwise More...
 
int EntityCount [get]
 Gets the number of entities in the map. More...
 
ulong NextID [get]
 Auto-increments the last generated GUID and retrieves the result More...
 

Detailed Description

Maps entities, systems and components to one another and provides querying and updating access to all elements

Constructor & Destructor Documentation

§ EntityMap() [1/2]

MB2D.EntityComponent.EntityMap.EntityMap ( )
inline

Initializes a new instance of the T:MB2D.EntityComponent.EntityMap class.

§ EntityMap() [2/2]

MB2D.EntityComponent.EntityMap.EntityMap ( EntityMap  map)
inline

Initializes a new instance of the T:MB2D.EntityComponent.EntityMap class. Uses an existing EntityMap to copy all registered systems and components as well as any persistant Entities.

Parameters
mapEntityMap to copy from

Member Function Documentation

§ AddComponent()

void MB2D.EntityComponent.EntityMap.AddComponent ( Type  componentType)
inline

Registers a new component type to the EntityMap

Parameters
componentTypeType of component to register

§ AddComponent< T >()

Registers a new component type to the EntityMap

Template Parameters
TType of component to register
Type Constraints
T :IComponent 

§ AddEntity()

void MB2D.EntityComponent.EntityMap.AddEntity ( Entity  entity)
inline

Adds a created entity to this map

Parameters
entityEntity to add

§ AddSystem< T >()

void MB2D.EntityComponent.EntityMap.AddSystem< T > ( params object []  args)
inline

Registers a new EntitySystem to the map

Template Parameters
TEntitySystem type to add
Type Constraints
T :EntitySystem 

§ Clear()

void MB2D.EntityComponent.EntityMap.Clear ( )
inline

Clears all entities from this map except for any marked as persistant.

Here is the caller graph for this function:

§ CreateEntity()

Entity MB2D.EntityComponent.EntityMap.CreateEntity ( string  tag = "")
inline

Creates a new Entity with the given tag in this map. Auto-Registers the entity with all systems and updates its mask.

Returns
The created entity
Parameters
tagTagname to give the entity
Here is the caller graph for this function:

§ GetComponentID< T >()

ulong MB2D.EntityComponent.EntityMap.GetComponentID< T > ( )
inline

Gets the id of a specified component type if it exists.

Returns
The component id mask.
Template Parameters
TType of component to query for.
Type Constraints
T :IComponent 

§ GetSystem< T >()

EntitySystem MB2D.EntityComponent.EntityMap.GetSystem< T > ( )
inline

Retrieves a pre-registered system from the map

Returns
The system if it exists; null otherwise
Template Parameters
TType of system to retrieve.
Type Constraints
T :EntitySystem 

§ UpdateEntityMask()

void MB2D.EntityComponent.EntityMap.UpdateEntityMask ( Entity  entity)
inline

Updates a specific entities component mask. Use after registering new components or systems.

Parameters
entityEntity to update
Here is the caller graph for this function:

§ UpdateSystems()

void MB2D.EntityComponent.EntityMap.UpdateSystems ( Entity  entity)
inline

Updates each systems associated entity list, adding the specified Entity. Use after creating a new Entity and adding it manually

Parameters
entityEntity to track in each system
Here is the caller graph for this function:

Property Documentation

§ EntityCount

int MB2D.EntityComponent.EntityMap.EntityCount
get

Gets the number of entities in the map.

The entity count.

§ NextID

ulong MB2D.EntityComponent.EntityMap.NextID
get

Auto-increments the last generated GUID and retrieves the result

The next identifier.

§ this[string key]

Entity MB2D.EntityComponent.EntityMap.this[string key]
get

Gets the T:MB2D.EntityComponent.Entity with the specified tag if it exists; null otherwise

Parameters
keyTagname of the entity to retireve.

The documentation for this class was generated from the following file: