Show / Hide Table of Contents

Interface IReadOnlyLayeredSpatialMap<T>

Interface implementing only the read-only functions for LayeredSpatialMap<T>/ AdvancedLayeredSpatialMap<T>.

Inherited Members
IReadOnlySpatialMap<T>.CanAdd(T, Point)
IReadOnlySpatialMap<T>.CanAdd(T, int, int)
IReadOnlySpatialMap<T>.CanMove(T, Point)
IReadOnlySpatialMap<T>.CanMove(T, int, int)
IReadOnlySpatialMap<T>.CanMoveAll(Point, Point)
IReadOnlySpatialMap<T>.CanMoveAll(int, int, int, int)
IReadOnlySpatialMap<T>.Contains(T)
IReadOnlySpatialMap<T>.Contains(Point)
IReadOnlySpatialMap<T>.Contains(int, int)
IReadOnlySpatialMap<T>.GetItemsAt(Point)
IReadOnlySpatialMap<T>.GetItemsAt(int, int)
IReadOnlySpatialMap<T>.GetPositionOfOrNull(T)
IReadOnlySpatialMap<T>.TryGetPositionOf(T, out Point)
IReadOnlySpatialMap<T>.GetPositionOf(T)
IReadOnlySpatialMap<T>.ToString(Func<T, string>)
IReadOnlySpatialMap<T>.Count
IReadOnlySpatialMap<T>.Items
IReadOnlySpatialMap<T>.Positions
IReadOnlySpatialMap<T>.ItemAdded
IReadOnlySpatialMap<T>.ItemMoved
IReadOnlySpatialMap<T>.ItemRemoved
IEnumerable<ItemPositionPair<T>>.GetEnumerator()
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

View Source

LayerMasker

Object used to get layer masks as they pertain to this spatial map.

Declaration
LayerMasker LayerMasker { get; }
Property Value
Type Description
LayerMasker
View Source

Layers

Gets read-only spatial maps representing each layer. To access a specific layer, instead use GetLayer(int).

Declaration
IEnumerable<IReadOnlySpatialMap<T>> Layers { get; }
Property Value
Type Description
IEnumerable<IReadOnlySpatialMap<T>>
View Source

NumberOfLayers

Gets the number of layers contained in the spatial map.

Declaration
int NumberOfLayers { get; }
Property Value
Type Description
int
View Source

StartingLayer

Starting index for layers contained in this spatial map.

Declaration
int StartingLayer { get; }
Property Value
Type Description
int

Methods

View Source

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.

View Source

CanMoveAll(Point, Point, uint)

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 = 4294967295)
Parameters
Type Name Description
Point current

Location to move items from.

Point target

Location to move items to.

uint layerMask

Layer mask indicating which layers to check items on.

Returns
Type Description
bool

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.

View Source

CanMoveAll(int, int, int, int, uint)

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 = 4294967295)
Parameters
Type Name Description
int currentX

X-value of the location to move items from.

int currentY

Y-value of the location to move items from.

int targetX

X-value of the location to move items to.

int targetY

Y-value of the location to move items to.

uint layerMask

Layer mask indicating which layers to check items on.

Returns
Type Description
bool

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.

View Source

Contains(Point, uint)

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 = 4294967295)
Parameters
Type Name Description
Point position

The position to check for.

uint layerMask

Layer mask that indicates which layers to check. Defaults to all layers.

Returns
Type Description
bool

True if there is some item at the given position on a layer included in the given layer mask, false if not.

View Source

Contains(int, int, uint)

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 = 4294967295)
Parameters
Type Name Description
int x

X-value of the position to check for.

int y

Y-value of the position to check for.

uint layerMask

Layer mask that indicates which layers to check. Defaults to all layers.

Returns
Type Description
bool

True if there is some item at the given position on a layer included in the given layer mask, false if not.

View Source

GetItemsAt(Point, uint)

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
ReadOnlyLayeredSpatialMapItemsAtEnumerator<T> GetItemsAt(Point position, uint layerMask = 4294967295)
Parameters
Type Name Description
Point position

The position to return the item(s) for.

uint layerMask

Layer mask that indicates which layers to check. Defaults to all layers.

Returns
Type Description
ReadOnlyLayeredSpatialMapItemsAtEnumerator<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.

View Source

GetItemsAt(int, int, uint)

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
ReadOnlyLayeredSpatialMapItemsAtEnumerator<T> GetItemsAt(int x, int y, uint layerMask = 4294967295)
Parameters
Type Name Description
int x

X-value of the position to return the item(s) for.

int y

Y-value of the position to return the item(s) for.

uint layerMask

Layer mask that indicates which layers to check. Defaults to all layers.

Returns
Type Description
ReadOnlyLayeredSpatialMapItemsAtEnumerator<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.

View Source

GetLayer(int)

Gets a read-only spatial map representing the layer specified.

Declaration
IReadOnlySpatialMap<T> GetLayer(int layer)
Parameters
Type Name Description
int layer

The layer to retrieve.

Returns
Type Description
IReadOnlySpatialMap<T>

The IReadOnlySpatialMap that represents the given layer.

View Source

GetLayersInMask(uint)

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 = 4294967295)
Parameters
Type Name Description
uint 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.

Extension Methods

PropertyChangedEventHelpers.SafelySetProperty<TObject, TProperty>(TObject, ref TProperty, TProperty, EventHandler<ValueChangedEventArgs<TProperty>>?)
PropertyChangedEventHelpers.SafelySetProperty<TObject, TProperty>(TObject, ref TProperty, TProperty, EventHandler<ValueChangedEventArgs<TProperty>>?, EventHandler<ValueChangedEventArgs<TProperty>>?)
ToStringExtensions.ExtendToString<T>(IEnumerable<T>, string, Func<T, string>?, string, string)
  • View Source
In this article
Back to top Generated by DocFX