Struct MapEntitiesAtCastEnumerator<T>
A custom enumerator used to iterate over all entities on a Map which are at a given location on given layers and are of a given type efficiently. Entities are returned in order from highest layer to lowest, as applicable. Any entities not of the given type are ignored.
Generally, you should use GetEntitiesAt<TEntity>(Point, uint) or one of that function's overloads to get an instance of this enumerator, rather than creating one yourself.
Inherited Members
Namespace: GoRogue.GameFramework
Assembly: GoRogue.dll
Syntax
public struct MapEntitiesAtCastEnumerator<T> : IEnumerable<T>, IEnumerable, IEnumerator<T>, IEnumerator, IDisposable where T : IGameObject
Type Parameters
Name | Description |
---|---|
T | The type of entities to look for. |
Remarks
This type is a struct, and as such is much more efficient when used in a foreach loop than a function returning IEnumerable<T> by using "yield return". This type does implement IEnumerable<T>, so you can pass it to functions which require one (for example, System.LINQ). However, this will have reduced performance due to boxing of the iterator.
Constructors
View SourceMapEntitiesAtCastEnumerator(Map, Point, uint)
Constructor.
Declaration
public MapEntitiesAtCastEnumerator(Map map, Point position, uint layerMask)
Parameters
Type | Name | Description |
---|---|---|
Map | map | Map to iterate over entities on. |
Point | position | The position to get entities at. |
uint | layerMask | A layer mask indicating what layers to include in the search for entities. |
Properties
View SourceCurrent
The current value for enumeration.
Declaration
public T Current { get; }
Property Value
Type | Description |
---|---|
T |
Methods
View SourceGetEnumerator()
Returns this enumerator.
Declaration
public MapEntitiesAtCastEnumerator<T> GetEnumerator()
Returns
Type | Description |
---|---|
MapEntitiesAtCastEnumerator<T> | This enumerator. |
MoveNext()
Declaration
public bool MoveNext()
Returns
Type | Description |
---|---|
bool |