11using Staple . Internal ;
22using System ;
3- using System . Collections ;
4- using System . Collections . Generic ;
53
64namespace Staple ;
75
@@ -33,7 +31,7 @@ public enum EntityQueryMode
3331/// It automatically updates as the world changes.
3432/// </summary>
3533/// <typeparam name="T">A type of component to get</typeparam>
36- public sealed class EntityQuery < T > : ISceneQuery , IEnumerable < T >
34+ public sealed class EntityQuery < T > : ISceneQuery
3735 where T : IComponent
3836{
3937 private T [ ] contents = [ ] ;
@@ -52,11 +50,21 @@ public sealed class EntityQuery<T> : ISceneQuery, IEnumerable<T>
5250 /// </summary>
5351 public T Content => content ;
5452
53+ /// <summary>
54+ /// Contained content. Only valid if we have a single element.
55+ /// </summary>
56+ public T [ ] Contents => contents ;
57+
5558 /// <summary>
5659 /// The content with its entity, if available.
5760 /// </summary>
5861 public ( Entity , T ) ContentEntity => contentEntity ;
5962
63+ /// <summary>
64+ /// The content with its entity, if available.
65+ /// </summary>
66+ public ( Entity , T ) [ ] ContentEntities => contentEntities ;
67+
6068 public T this [ int index ] => contents [ index ] ;
6169
6270 /// <summary>
@@ -168,20 +176,4 @@ public void WorldChanged()
168176 }
169177 }
170178 }
171-
172- public IEnumerator < T > GetEnumerator ( )
173- {
174- foreach ( var result in contents )
175- {
176- yield return result ;
177- }
178- }
179-
180- IEnumerator IEnumerable . GetEnumerator ( )
181- {
182- foreach ( var result in contents )
183- {
184- yield return result ;
185- }
186- }
187179}
0 commit comments