feat: Shape IEnumerable
This commit is contained in:
parent
468615e4cb
commit
bfab35c27e
|
@ -1,11 +1,12 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using Syntriax.Engine.Core;
|
using Syntriax.Engine.Core;
|
||||||
|
|
||||||
namespace Syntriax.Engine.Physics2D.Primitives;
|
namespace Syntriax.Engine.Physics2D.Primitives;
|
||||||
|
|
||||||
public record Shape(IList<Vector2D> Vertices)
|
public record Shape(IList<Vector2D> Vertices) : IEnumerable<Vector2D>
|
||||||
{
|
{
|
||||||
public Vector2D this[Index index] => Vertices[index];
|
public Vector2D this[Index index] => Vertices[index];
|
||||||
|
|
||||||
|
@ -61,6 +62,9 @@ public record Shape(IList<Vector2D> Vertices)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerator<Vector2D> GetEnumerator() => Vertices.GetEnumerator();
|
||||||
|
IEnumerator IEnumerable.GetEnumerator() => Vertices.GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ShapeExtensions
|
public static class ShapeExtensions
|
||||||
|
|
Loading…
Reference in New Issue