Engine-Pong/Shared/Behaviours/DrawableColliderShape.cs
2025-08-05 20:12:07 +03:00

27 lines
739 B
C#

using System.Collections.Generic;
using Engine.Core;
using Engine.Integration.MonoGame;
namespace Pong.Behaviours;
public class DrawableColliderShape : Engine.Physics2D.Collider2DShape, IDrawableTriangle
{
private readonly IList<Triangle> triangles = [];
public ColorRGBA Color { get; set; } = new ColorRGBA(255, 255, 255);
public void Draw(ITriangleBatch triangleBatch)
{
Recalculate();
ShapeWorld.ToTrianglesConvex(triangles);
foreach (Triangle triangle in triangles)
triangleBatch.Draw(triangle, Color);
}
public DrawableColliderShape(Shape2D shape) : base(shape) { }
public DrawableColliderShape(Shape2D shape, ColorRGBA color) : base(shape) { Color = color; }
}