A 2D Grid that represents a particular space in the game world to check for collisions. Uses spatial indexing to determine where an entity will be located at any given time. For best results, the cellsize and overall size of the map should be tweaked for each individual game screen and environment.
More...
|
Grid | Grid [get] |
| Gets the geometric representation of the grid More...
|
|
Vector2 | Position [get] |
| Gets the current position of the grid. More...
|
|
Vector2 | Max [get] |
| Gets the upper bounds of the x and y coordinates in the grid More...
|
|
A 2D Grid that represents a particular space in the game world to check for collisions. Uses spatial indexing to determine where an entity will be located at any given time. For best results, the cellsize and overall size of the map should be tweaked for each individual game screen and environment.
§ CollisionMap()
MB2D.Collision.CollisionMap.CollisionMap |
( |
int |
xMin, |
|
|
int |
xMax, |
|
|
int |
yMin, |
|
|
int |
yMax, |
|
|
int |
cellSize |
|
) |
| |
|
inline |
Initializes a new instance of the T:MB2D.Collision.CollisionMap class.
- Parameters
-
xMin | The grids left most x coordinate. |
xMax | Right most x coordinae. |
yMin | Top most y coordinate. |
yMax | Bottom most y coordinate. |
cellSize | The size of each cell in the grid. |
§ Clear()
void MB2D.Collision.CollisionMap.Clear |
( |
| ) |
|
|
inline |
Clears all non-empty cells of the grid from their entities
§ GetCollisions()
Gets a list of all entities located in the same cell/s as a specific single entity
- Returns
- The entities neighbours.
- Parameters
-
entity | Entity to get collisions for. |
collision | Collision component to use in checking. |
§ IndexExists() [1/2]
bool MB2D.Collision.CollisionMap.IndexExists |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
|
inline |
Checks if a particular index exists in the grid
- Returns
true
, if index exists, false
otherwise.
- Parameters
-
x | The x coordinate. |
y | The y coordinate. |
§ IndexExists() [2/2]
bool MB2D.Collision.CollisionMap.IndexExists |
( |
Point |
index | ) |
|
|
inline |
Checks if a particular index exists in the grid
- Returns
true
, if index exists, false
otherwise.
- Parameters
-
§ IndexOf()
Point MB2D.Collision.CollisionMap.IndexOf |
( |
Point |
position | ) |
|
|
inline |
Indexes a world-based coordinate into the collision grid
- Returns
- The grid-based position.
- Parameters
-
position | World-based position to index. |
§ Insert()
Inserts an entity and its associated collision component into the grid
- Parameters
-
entity | Entity to insert. |
collision | The entities collision component. |
§ UpdatePosition()
void MB2D.Collision.CollisionMap.UpdatePosition |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
|
inline |
Updates the position of the collision grid.
- Parameters
-
x | The x coordinate. |
y | The y coordinate. |
§ Grid
Grid MB2D.Collision.CollisionMap.Grid |
|
get |
Gets the geometric representation of the grid
The grid.
§ Max
Vector2 MB2D.Collision.CollisionMap.Max |
|
get |
Gets the upper bounds of the x and y coordinates in the grid
The max coordinates.
§ Position
Vector2 MB2D.Collision.CollisionMap.Position |
|
get |
Gets the current position of the grid.
The position.
The documentation for this class was generated from the following file:
- MB2D/src/Collision/CollisionMap.cs