30 lines
808 B
C#
30 lines
808 B
C#
using Syntriax.Engine.Core;
|
|
using Syntriax.Engine.Physics2D.Abstract;
|
|
|
|
namespace Syntriax.Engine.Physics2D;
|
|
|
|
public class Collider2DShapeBehaviour : Collider2DBehaviourBase, IShapeCollider2D
|
|
{
|
|
public Shape2D ShapeWorld { get => _shapeWorld; protected set => _shapeWorld = value; }
|
|
public Shape2D ShapeLocal
|
|
{
|
|
get => _shapeLocal;
|
|
set
|
|
{
|
|
_shapeLocal = value;
|
|
NeedsRecalculation = true;
|
|
}
|
|
}
|
|
|
|
private Shape2D _shapeWorld = Shape2D.Square.CreateCopy();
|
|
private Shape2D _shapeLocal = Shape2D.Square;
|
|
|
|
public override void CalculateCollider() => Transform.Transform(ShapeLocal, ref _shapeWorld);
|
|
|
|
public Collider2DShapeBehaviour() { }
|
|
public Collider2DShapeBehaviour(Shape2D shape)
|
|
{
|
|
ShapeLocal = shape;
|
|
}
|
|
}
|