Struct ReadOnlyLayeredSpatialMapItemsAtEnumerator<T>
A custom enumerator used to iterate over all positions at a given location in a layered spatial map implementation efficiently.
Generally, you should use GetItemsAt(Point, uint) (or one of its overloads) to get an instance of this, rather than creating one yourself.
Inherited Members
Namespace: SadRogue.Primitives.SpatialMaps
Assembly: TheSadRogue.Primitives.dll
Syntax
public struct ReadOnlyLayeredSpatialMapItemsAtEnumerator<T> : IEnumerable<T>, IEnumerable, IEnumerator<T>, IEnumerator, IDisposable where T : IHasLayer
Type Parameters
| Name | Description |
|---|---|
| T |
Remarks
This type is a struct, and as such is notably 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 SourceReadOnlyLayeredSpatialMapItemsAtEnumerator(IReadOnlyLayeredSpatialMap<T>, Point, uint)
Creates an enumerator which iterates over all items at the given point in the spatial map given, which are on layers in the given layer mask.
Declaration
public ReadOnlyLayeredSpatialMapItemsAtEnumerator(IReadOnlyLayeredSpatialMap<T> map, Point position, uint layerMask)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyLayeredSpatialMap<T> | map | The spatial map to check for items in. |
| Point | position | The position to retrieve items at. |
| uint | layerMask | The layer mask specifying layers to check. |
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 ReadOnlyLayeredSpatialMapItemsAtEnumerator<T> GetEnumerator()
Returns
| Type | Description |
|---|---|
| ReadOnlyLayeredSpatialMapItemsAtEnumerator<T> | This enumerator. |
MoveNext()
Advances the iterator to the next item.
Declaration
public bool MoveNext()
Returns
| Type | Description |
|---|---|
| bool | True if the a new item at the position given within the specified layers; false otherwise. |