feat: Shape & Circle Collider Constructors

This commit is contained in:
Syntriax 2024-01-27 20:19:55 +03:00
parent 574104c224
commit ab2489f6cf
2 changed files with 16 additions and 0 deletions

View File

@ -11,4 +11,12 @@ public class Collider2DCircleBehaviour : Collider2DBehaviourBase, ICircleCollide
public override void CalculateCollider() => CircleWorld = Transform.TransformCircle(CircleLocal); public override void CalculateCollider() => CircleWorld = Transform.TransformCircle(CircleLocal);
public Collider2DCircleBehaviour() { }
public Collider2DCircleBehaviour(Circle circle)
{
CircleLocal = circle;
Recalculate();
}
} }

View File

@ -11,4 +11,12 @@ public class Collider2DShapeBehaviour : Collider2DBehaviourBase, IShapeCollider2
protected Shape _shapeWorld = new([new(1f, 1f), new(-1f, 1f), new(-1f, -1f), new(1f, -1f)]); protected Shape _shapeWorld = new([new(1f, 1f), new(-1f, 1f), new(-1f, -1f), new(1f, -1f)]);
public override void CalculateCollider() => Transform.TransformShape(ShapeLocal, ref _shapeWorld); public override void CalculateCollider() => Transform.TransformShape(ShapeLocal, ref _shapeWorld);
public Collider2DShapeBehaviour() { }
public Collider2DShapeBehaviour(Shape shape)
{
ShapeLocal = shape;
Recalculate();
}
} }