From bfab35c27ec25c265d3ee63efb5ed90109e79cc1 Mon Sep 17 00:00:00 2001 From: Syntriax Date: Wed, 24 Jan 2024 12:50:26 +0300 Subject: [PATCH] feat: Shape IEnumerable --- Engine.Physics2D/Primitives/Shape.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Engine.Physics2D/Primitives/Shape.cs b/Engine.Physics2D/Primitives/Shape.cs index 3d1dc87..dbd3987 100644 --- a/Engine.Physics2D/Primitives/Shape.cs +++ b/Engine.Physics2D/Primitives/Shape.cs @@ -1,11 +1,12 @@ using System; +using System.Collections; using System.Collections.Generic; using Syntriax.Engine.Core; namespace Syntriax.Engine.Physics2D.Primitives; -public record Shape(IList Vertices) +public record Shape(IList Vertices) : IEnumerable { public Vector2D this[Index index] => Vertices[index]; @@ -61,6 +62,9 @@ public record Shape(IList Vertices) return true; } + + public IEnumerator GetEnumerator() => Vertices.GetEnumerator(); + IEnumerator IEnumerable.GetEnumerator() => Vertices.GetEnumerator(); } public static class ShapeExtensions