Show / Hide Table of Contents

Struct MapObjectsAtEnumerator

A custom enumerator used to iterate over all objects on a Map which are at a given location on given layers efficiently. Items are returned in order from highest layer to lowest, as applicable.

Generally, you should use GetObjectsAt(Point, uint) or one of that function's overloads to get an instance of this enumerator, rather than creating one yourself.

Implements
IEnumerable<IGameObject>
IEnumerable
IEnumerator<IGameObject>
IEnumerator
IDisposable
Inherited Members
ValueType.Equals(object)
ValueType.GetHashCode()
ValueType.ToString()
object.GetType()
object.Equals(object, object)
object.ReferenceEquals(object, object)
Namespace: GoRogue.GameFramework
Assembly: GoRogue.dll
Syntax
public struct MapObjectsAtEnumerator : IEnumerable<IGameObject>, IEnumerable, IEnumerator<IGameObject>, IEnumerator, IDisposable
Remarks

This type is a struct, and as such is much more efficient when used in a foreach loop than a function returning IEnumerable<IGameObject> 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 Source

MapObjectsAtEnumerator(Map, Point, uint)

Constructor.

Declaration
public MapObjectsAtEnumerator(Map map, Point position, uint layerMask)
Parameters
Type Name Description
Map map

Map to iterate over objects on.

Point position

The position to get objects at.

uint layerMask

A layer mask indicating what layers to include in the search for items.

Properties

View Source

Current

The current value for enumeration.

Declaration
public IGameObject Current { get; }
Property Value
Type Description
IGameObject

Methods

View Source

GetEnumerator()

Returns this enumerator.

Declaration
public MapObjectsAtEnumerator GetEnumerator()
Returns
Type Description
MapObjectsAtEnumerator

This enumerator.

View Source

MoveNext()

Declaration
public bool MoveNext()
Returns
Type Description
bool

Implements

IEnumerable<T>
IEnumerable
IEnumerator<T>
IEnumerator
IDisposable

Extension Methods

Utility.Yield<T>(T)
  • View Source
In this article
Back to top Generated by DocFX