mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-15 23:19:29 +00:00
Merge pull request #825 from craftworkgames/new_collision_2023
Add constructor for CollisionComponent.cs
This commit is contained in:
@@ -27,7 +27,7 @@ namespace MonoGame.Extended.Collisions
|
||||
private HashSet<(Layer, Layer)> _layerCollision = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a collision tree covering the specified area.
|
||||
/// Creates component with default layer, which is a collision tree covering the specified area (using <see cref="QuadTree"/>.
|
||||
/// </summary>
|
||||
/// <param name="boundary">Boundary of the collision tree.</param>
|
||||
public CollisionComponent(RectangleF boundary)
|
||||
@@ -35,6 +35,17 @@ namespace MonoGame.Extended.Collisions
|
||||
SetDefaultLayer(new Layer(new QuadTreeSpace(boundary)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates component with specifies default layer.
|
||||
/// If layer is null, method creates component without default layer.
|
||||
/// </summary>
|
||||
/// <param name="layer">Default layer</param>
|
||||
public CollisionComponent(Layer layer = null)
|
||||
{
|
||||
if (layer is not null)
|
||||
SetDefaultLayer(layer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The main layer has the name from <see cref="DEFAULT_LAYER_NAME"/>.
|
||||
/// The main layer collision with itself and all other layers.
|
||||
|
||||
Reference in New Issue
Block a user