Interface IReadOnlyLayeredSpatialMap<T>
Interface implementing only the read-only functions for LayeredSpatialMap<T>/ AdvancedLayeredSpatialMap<T>.
Inherited Members
Namespace: SadRogue.Primitives.SpatialMaps
Assembly: TheSadRogue.Primitives.dll
Syntax
public interface IReadOnlyLayeredSpatialMap<T> : IReadOnlySpatialMap<T>, IEnumerable<ItemPositionPair<T>>, IEnumerable where T : IHasLayer
Type Parameters
Name | Description |
---|---|
T | Type of element stored in the layered spatial map -- must implement IHasLayer. |
Properties
LayerMasker
Object used to get layer masks as they pertain to this spatial map.
Declaration
LayerMasker LayerMasker { get; }
Property Value
Type | Description |
---|---|
LayerMasker |
Layers
Gets read-only spatial maps representing each layer. To access a specific layer, instead use GetLayer(Int32).
Declaration
IEnumerable<IReadOnlySpatialMap<T>> Layers { get; }
Property Value
Type | Description |
---|---|
IEnumerable<IReadOnlySpatialMap<T>> |
NumberOfLayers
Gets the number of layers contained in the spatial map.
Declaration
int NumberOfLayers { get; }
Property Value
Type | Description |
---|---|
Int32 |
StartingLayer
Starting index for layers contained in this spatial map.
Declaration
int StartingLayer { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
AsReadOnly()
Returns a read-only reference to the spatial map. Convenient for "safely" exposing the spatial map as a property.
Declaration
IReadOnlyLayeredSpatialMap<T> AsReadOnly()
Returns
Type | Description |
---|---|
IReadOnlyLayeredSpatialMap<T> | The current spatial map, as a "read-only" reference. |
CanMoveAll(Point, Point, UInt32)
Returns true if there are items at current
on one or more of the layers specified by the layer
mask,
and all items on those layers at that position can be moved to target
; false otherwise.
Declaration
bool CanMoveAll(Point current, Point target, uint layerMask = 4294967295U)
Parameters
Type | Name | Description |
---|---|---|
Point | current | Location to move items from. |
Point | target | Location to move items to. |
UInt32 | layerMask | Layer mask indicating which layers to check items on. |
Returns
Type | Description |
---|---|
Boolean | true if all items at the position current can be moved to the position target; false if one or more items cannot be moved or there are no items to move. |
CanMoveAll(Int32, Int32, Int32, Int32, UInt32)
Returns true if there are items at the current position on one or more of the layers specified by the layer mask, and all items on those layers at that position can be moved to the target position; false otherwise.
Declaration
bool CanMoveAll(int currentX, int currentY, int targetX, int targetY, uint layerMask = 4294967295U)
Parameters
Type | Name | Description |
---|---|---|
Int32 | currentX | X-value of the location to move items from. |
Int32 | currentY | Y-value of the location to move items from. |
Int32 | targetX | X-value of the location to move items to. |
Int32 | targetY | Y-value of the location to move items to. |
UInt32 | layerMask | Layer mask indicating which layers to check items on. |
Returns
Type | Description |
---|---|
Boolean | true if all items at the position current can be moved to the position target; false if one or more items cannot be moved or there are no items to move. |
Contains(Point, UInt32)
Returns whether or not there is an item in the spatial map at the given position that is on a layer included in the given layer mask. Defaults to searching on all layers.
Declaration
bool Contains(Point position, uint layerMask = 4294967295U)
Parameters
Type | Name | Description |
---|---|---|
Point | position | The position to check for. |
UInt32 | layerMask | Layer mask that indicates which layers to check. Defaults to all layers. |
Returns
Type | Description |
---|---|
Boolean | True if there is some item at the given position on a layer included in the given layer mask, false if not. |
Contains(Int32, Int32, UInt32)
Returns whether or not there is an item in the data structure at the given position, that is on a layer included in the given layer mask.
Declaration
bool Contains(int x, int y, uint layerMask = 4294967295U)
Parameters
Type | Name | Description |
---|---|---|
Int32 | x | X-value of the position to check for. |
Int32 | y | Y-value of the position to check for. |
UInt32 | layerMask | Layer mask that indicates which layers to check. Defaults to all layers. |
Returns
Type | Description |
---|---|
Boolean | True if there is some item at the given position on a layer included in the given layer mask, false if not. |
GetItemsAt(Point, UInt32)
Gets the item(s) associated with the given position that reside on any layer included in the given layer mask. Returns nothing if there is nothing at that position on a layer included in the given layer mask.
Declaration
IEnumerable<T> GetItemsAt(Point position, uint layerMask = 4294967295U)
Parameters
Type | Name | Description |
---|---|---|
Point | position | The position to return the item(s) for. |
UInt32 | layerMask | Layer mask that indicates which layers to check. Defaults to all layers. |
Returns
Type | Description |
---|---|
IEnumerable<T> | The item(s) at the given position that reside on a layer included in the layer mask if there are any items, or nothing if there is nothing at that position. |
GetItemsAt(Int32, Int32, UInt32)
Gets the item(s) associated with the given position that reside on any layer included in the given layer mask. Returns nothing if there is nothing at that position on a layer included in the given layer mask.
Declaration
IEnumerable<T> GetItemsAt(int x, int y, uint layerMask = 4294967295U)
Parameters
Type | Name | Description |
---|---|---|
Int32 | x | X-value of the position to return the item(s) for. |
Int32 | y | Y-value of the position to return the item(s) for. |
UInt32 | layerMask | Layer mask that indicates which layers to check. Defaults to all layers. |
Returns
Type | Description |
---|---|
IEnumerable<T> | The item(s) at the given position that reside on a layer included in the layer mask if there are any items, or nothing if there is nothing at that position. |
GetLayer(Int32)
Gets a read-only spatial map representing the layer specified.
Declaration
IReadOnlySpatialMap<T> GetLayer(int layer)
Parameters
Type | Name | Description |
---|---|---|
Int32 | layer | The layer to retrieve. |
Returns
Type | Description |
---|---|
IReadOnlySpatialMap<T> | The IReadOnlySpatialMap that represents the given layer. |
GetLayersInMask(UInt32)
Returns read-only spatial maps that represent each layer included in the given layer mask. Defaults to all layers.
Declaration
IEnumerable<IReadOnlySpatialMap<T>> GetLayersInMask(uint layerMask = 4294967295U)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | layerMask | Layer mask indicating which layers to return. Defaults to all layers. |
Returns
Type | Description |
---|---|
IEnumerable<IReadOnlySpatialMap<T>> | Read-only spatial maps representing each layer in the given layer mask. |