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

Checks collisions. Uses a spatial indexing grid for broad-phase collision checking and AABB checks for narrow phase More...

Inheritance diagram for MB2D.EntityComponent.CollisionSystem:
Inheritance graph
Collaboration diagram for MB2D.EntityComponent.CollisionSystem:
Collaboration graph

Public Member Functions

 CollisionSystem ()
 Initializes a new instance of the T:MB2D.EntityComponent.CollisionSystem class. More...
 
void ResetGrid (int xMin, int xMax, int yMin, int yMax, int cellSize)
 Resets the grid position in the world. More...
 
void SetTileMap (TileMap tileMap)
 Sets the current tile map to check for collisions More...
 
- Public Member Functions inherited from MB2D.EntityComponent.EntitySystem
 EntitySystem (params Type[] components)
 Initializes a new instance of the T:MB2D.EntityComponent.EntitySystem class. Checks if the passed in types are valid components and if not, all components are deregistered leaving a system that knows about nothing and can't operate on any entities. More...
 
void Run ()
 Runs this systems Process() method on all entities More...
 
void AssociateEntity (Entity entity)
 Associates a new entity with this system. More...
 
void RemoveAssociation (Entity entity)
 Decouples an association with this system More...
 

Protected Member Functions

override void PreProcess ()
 Clears the collision grid and inserts all entities before checking collisions More...
 
override void ProcessingLoop ()
 Override. Only processes entities with movement components. Still considers static entities, but only as possible neighbours. More...
 
override void Process (Entity entity)
 Checks all collisions within the entities known collision cells More...
 
- Protected Member Functions inherited from MB2D.EntityComponent.EntitySystem
void Destroy (Entity entity)
 Adds the specific entity to the destroy list to be cleaned up the next time a system is run More...
 
virtual void PostProcess ()
 Used to cleanup or execute any teardown logic needed More...
 
virtual void PostAssociate (Entity entity)
 Used to define any logic or extra data needed after an entity is associated with the system. More...
 

Properties

CollisionMap CurrentMap [get]
 Gets the current collision map. More...
 
int NumberOfChecks [get]
 Gets the number of collision checks made last frame. Used for debugging. More...
 
- Properties inherited from MB2D.EntityComponent.EntitySystem
List< EntityAssociatedEntities [get, set]
 Gets or sets the associated entities list. More...
 
List< Type > ValidComponents [get]
 Gets the list of components this system is interested in More...
 
ulong ID [get, set]
 Gets or sets this systems ID mask More...
 
List< EntityDestroyList [get]
 Gets the destroy list. More...
 
EntityAssociation Association [get]
 Gets the systems association level. More...
 

Additional Inherited Members

- Protected Attributes inherited from MB2D.EntityComponent.EntitySystem
Dictionary< ulong, Entity_idEntityMap
 All GUID's of entities this system knows about More...
 
EntityAssociation _associationType
 Defines if this system should be Loose or Strict More...
 

Detailed Description

Checks collisions. Uses a spatial indexing grid for broad-phase collision checking and AABB checks for narrow phase

Constructor & Destructor Documentation

§ CollisionSystem()

MB2D.EntityComponent.CollisionSystem.CollisionSystem ( )
inline

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

Member Function Documentation

§ PreProcess()

override void MB2D.EntityComponent.CollisionSystem.PreProcess ( )
inlineprotectedvirtual

Clears the collision grid and inserts all entities before checking collisions

Reimplemented from MB2D.EntityComponent.EntitySystem.

Here is the call graph for this function:

§ Process()

override void MB2D.EntityComponent.CollisionSystem.Process ( Entity  entity)
inlineprotectedvirtual

Checks all collisions within the entities known collision cells

Parameters
entityEntity to check.

Implements MB2D.EntityComponent.EntitySystem.

Here is the call graph for this function:

§ ProcessingLoop()

override void MB2D.EntityComponent.CollisionSystem.ProcessingLoop ( )
inlineprotectedvirtual

Override. Only processes entities with movement components. Still considers static entities, but only as possible neighbours.

Reimplemented from MB2D.EntityComponent.EntitySystem.

§ ResetGrid()

void MB2D.EntityComponent.CollisionSystem.ResetGrid ( int  xMin,
int  xMax,
int  yMin,
int  yMax,
int  cellSize 
)
inline

Resets the grid position in the world.

Parameters
xMinThe grids left most x coordinate.
xMaxRight most x coordinae.
yMinTop most y coordinate.
yMaxBottom most y coordinate.
cellSizeThe size of each cell in the grid.
Here is the caller graph for this function:

§ SetTileMap()

void MB2D.EntityComponent.CollisionSystem.SetTileMap ( TileMap  tileMap)
inline

Sets the current tile map to check for collisions

Parameters
tileMapTile map.
Here is the caller graph for this function:

Property Documentation

§ CurrentMap

CollisionMap MB2D.EntityComponent.CollisionSystem.CurrentMap
get

Gets the current collision map.

The current map.

§ NumberOfChecks

int MB2D.EntityComponent.CollisionSystem.NumberOfChecks
get

Gets the number of collision checks made last frame. Used for debugging.

The number of collision checks.


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