Show / Hide Table of Contents

Interface IReadOnlyMapArea

Read-only interface for an arbitrarily-shaped area of the map.

Namespace: GoRogue.MapGeneration
Assembly: GoRogue.dll
Syntax
public interface IReadOnlyMapArea

Properties

| Improve this Doc View Source

Bounds

Smallest possible rectangle that encompasses every position in the area.

Declaration
Rectangle Bounds { get; }
Property Value
Type Description
Rectangle
| Improve this Doc View Source

Count

Number of (unique) positions in the currently stored list of positions.

Declaration
int Count { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Positions

List of all (unique) positions in the list.

Declaration
IReadOnlyList<Coord> Positions { get; }
Property Value
Type Description
System.Collections.Generic.IReadOnlyList<Coord>

Methods

| Improve this Doc View Source

Contains(Coord)

Determines whether or not the given position is considered within the area or not.

Declaration
bool Contains(Coord position)
Parameters
Type Name Description
Coord position

The position to check.

Returns
Type Description
System.Boolean

True if the specified position is within the area, false otherwise.

| Improve this Doc View Source

Contains(IReadOnlyMapArea)

Returns whether or not the given map area is completely contained within the current one.

Declaration
bool Contains(IReadOnlyMapArea area)
Parameters
Type Name Description
IReadOnlyMapArea area

Area to check.

Returns
Type Description
System.Boolean

True if the given area is completely contained within the current one, false otherwise.

| Improve this Doc View Source

Contains(Int32, Int32)

Determines whether or not the given position is considered within the area or not.

Declaration
bool Contains(int x, int y)
Parameters
Type Name Description
System.Int32 x

X-coordinate of the position to check.

System.Int32 y

Y-coordinate of the position to check.

Returns
Type Description
System.Boolean

True if the specified position is within the area, false otherwise.

| Improve this Doc View Source

Intersects(IReadOnlyMapArea)

Returns whether or not the given map area intersects the current one. If you intend to determine/use the exact intersection based on this return value, it is best to instead call GetIntersection(IReadOnlyMapArea, IReadOnlyMapArea), and check the number of positions in the result (0 if no intersection).

Declaration
bool Intersects(IReadOnlyMapArea area)
Parameters
Type Name Description
IReadOnlyMapArea area

The area to check.

Returns
Type Description
System.Boolean

True if the given area intersects the current one, false otherwise.

| Improve this Doc View Source

RandomPosition(Func<Coord, Boolean>, IGenerator)

Gets a random position from the map area for which the given selector returns true. Positions are repeatedly selected until a valid one is found.

Declaration
Coord RandomPosition(Func<Coord, bool> selector, IGenerator rng = null)
Parameters
Type Name Description
System.Func<Coord, System.Boolean> selector

A function that should return true for any coordinate that is a valid selection, and false otherwise.

Troschuetz.Random.IGenerator rng

The rng to use. Defaults to DefaultRNG.

Returns
Type Description
Coord

A random position from within the map area for which the selector given returns true.

| Improve this Doc View Source

RandomPosition(IGenerator)

Gets a random position from the area.

Declaration
Coord RandomPosition(IGenerator rng = null)
Parameters
Type Name Description
Troschuetz.Random.IGenerator rng

The rng to use. Defaults to DefaultRNG.

Returns
Type Description
Coord

A random position from within the map area.

Extension Methods

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