Class MultiSpatialMap<T>
An implementation of ISpatialMap<T> that allows multiple items to reside at any given position at the same time. If you wish to allow only one item to reside at each location at a time, use SpatialMap<T> instead. For a situation involving different categories or layers of items, you may want to look at LayeredSpatialMap<T>.
Implements
Inherited Members
Namespace: GoRogue
Assembly: GoRogue.dll
Syntax
public class MultiSpatialMap<T> : AdvancedMultiSpatialMap<T>, ISpatialMap<T>, IReadOnlySpatialMap<T>, IEnumerable<ISpatialTuple<T>>, IEnumerable where T : class, IHasID
Type Parameters
Name | Description |
---|---|
T | The type of items being stored in the spatial map. Must implement IHasID and be a reference-type. |
Remarks
See the ISpatialMap<T> for documentation on the practical purpose of spatial maps.
The objects stored in a MultiSpatialMap must implement IHasID. This is used internally to keep track of the objects, since uints are easily (and efficiently) hashable.
Although MultiSpatialMap is generally quite performant, if you know the spatial map will only have one item at any given position at a time, SpatialMap<T> may yield better performance.
Constructors
| Improve this Doc View SourceMultiSpatialMap(Int32)
Constructor.
Declaration
public MultiSpatialMap(int initialCapacity = 32)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | initialCapacity | The initial maximum number of elements the spatial map can hold before it has to internally resize data structures. Defaults to 32. |