Files
Engine-Pong/Shared/Behaviours/DrawableColliderShape.cs
2026-01-31 01:07:30 +03:00

27 lines
735 B
C#

using System.Collections.Generic;
using Engine.Core;
using Engine.Systems.Graphics;
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; }
}