Show / Hide Table of Contents

Class AdjacencyRule

Class representing a method for determining which coordinates are adjacent to a given coordinate, and which directions those neighbors are in. Cannot be instantiated -- premade static instances are provided.

Inheritance
System.Object
AdjacencyRule
Implements
System.IEquatable<AdjacencyRule>
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: GoRogue
Assembly: GoRogue.dll
Syntax
[Serializable]
public class AdjacencyRule : IEquatable<AdjacencyRule>

Fields

| Improve this Doc View Source

CARDINALS

Represents method of determining adjacency where neighbors are considered adjacent if they are in a cardinal direction, eg. 4-way (manhattan-based) connectivity.

Declaration
[NonSerialized]
public static readonly AdjacencyRule CARDINALS
Field Value
Type Description
AdjacencyRule
| Improve this Doc View Source

DIAGONALS

Represents method of determining adjacency where neighbors are considered adjacent only if they are in a diagonal direction.

Declaration
[NonSerialized]
public static readonly AdjacencyRule DIAGONALS
Field Value
Type Description
AdjacencyRule
| Improve this Doc View Source

EIGHT_WAY

Represents method of determining adjacency where all 8 possible neighbors are considered adjacent (eg. 8-way connectivity).

Declaration
[NonSerialized]
public static readonly AdjacencyRule EIGHT_WAY
Field Value
Type Description
AdjacencyRule
| Improve this Doc View Source

Type

Enum value representing the method of determining adjacency -- useful for using AdjacencyRule types in switch statements.

Declaration
public readonly AdjacencyRule.Types Type
Field Value
Type Description
AdjacencyRule.Types

Methods

| Improve this Doc View Source

DirectionsOfNeighbors()

Gets directions leading to neighboring locations, according to the current adjacency method. Cardinals are returned before any diagonals.

Declaration
public IEnumerable<Direction> DirectionsOfNeighbors()
Returns
Type Description
System.Collections.Generic.IEnumerable<Direction>

Directions that lead to neighboring locations.

| Improve this Doc View Source

DirectionsOfNeighborsClockwise(Direction)

Gets directions leading to neighboring locations, according to the current adjacency method. Appropriate directions are returned in clockwise order from the given starting direction.

Declaration
public IEnumerable<Direction> DirectionsOfNeighborsClockwise(Direction startingDirection = null)
Parameters
Type Name Description
Direction startingDirection

The direction to start with. null or NONE causes the default starting direction to be used, which is UP for CARDINALS/EIGHT_WAY, and UP_RIGHT for diagonals.

Returns
Type Description
System.Collections.Generic.IEnumerable<Direction>

Directions that lead to neighboring locations.

| Improve this Doc View Source

DirectionsOfNeighborsCounterClockwise(Direction)

Gets directions leading to neighboring locations, according to the current adjacency method. Appropriate directions are returned in counter-clockwise order from the given starting direction.

Declaration
public IEnumerable<Direction> DirectionsOfNeighborsCounterClockwise(Direction startingDirection = null)
Parameters
Type Name Description
Direction startingDirection

The direction to start with. null or NONE causes the default starting direction to be used, which is UP for CARDINALS/EIGHT_WAY, and UP_LEFT for diagonals.

Returns
Type Description
System.Collections.Generic.IEnumerable<Direction>

Directions that lead to neighboring locations.

| Improve this Doc View Source

Equals(AdjacencyRule)

Compares the current AdjacencyRule to the one given.

Declaration
public bool Equals(AdjacencyRule other)
Parameters
Type Name Description
AdjacencyRule other
Returns
Type Description
System.Boolean

True if the given AdjacencyRule has the same Type, false otherwise.

| Improve this Doc View Source

Equals(Object)

Compares the current AdjacencyRule to the object given.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean

True if the given object is an AdjacencyRule with the same Type, false otherwise.

Overrides
System.Object.Equals(System.Object)
| Improve this Doc View Source

GetHashCode()

Returns a hash-value for this object.

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32
Overrides
System.Object.GetHashCode()
| Improve this Doc View Source

Neighbors(Coord)

Gets all neighbors of the specified location, based on the current adjacency method. Cardinals are returned before any diagonals.

Declaration
public IEnumerable<Coord> Neighbors(Coord startingLocation)
Parameters
Type Name Description
Coord startingLocation

Location to return neighbors for.

Returns
Type Description
System.Collections.Generic.IEnumerable<Coord>

All neighbors of the given location.

| Improve this Doc View Source

Neighbors(Int32, Int32)

Gets all neighbors of the specified location, based on the current adjacency method. Cardinals are returned before any diagonals.

Declaration
public IEnumerable<Coord> Neighbors(int startingX, int startingY)
Parameters
Type Name Description
System.Int32 startingX

X-coordinate of location to return neighbors for.

System.Int32 startingY

Y-coordinate of location to return neighbors for.

Returns
Type Description
System.Collections.Generic.IEnumerable<Coord>

All neighbors of the given location.

| Improve this Doc View Source

NeighborsClockwise(Coord, Direction)

Gets all neighbors of the specified location, based on the current adjacency method. Neighbors are returned in clockwise order, starting with the neighbor in the given starting direction.

Declaration
public IEnumerable<Coord> NeighborsClockwise(Coord startingLocation, Direction startingDirection = null)
Parameters
Type Name Description
Coord startingLocation

Location to return neighbors for.

Direction startingDirection

The neighbor in this direction will be returned first, proceeding clockwise. If null or NONE is specified, the default starting direction is used, which is UP for CARDINALS/EIGHT_WAY, and UP_RIGHT for DIAGONALS.

Returns
Type Description
System.Collections.Generic.IEnumerable<Coord>

All neighbors of the given location.

| Improve this Doc View Source

NeighborsClockwise(Int32, Int32, Direction)

Gets all neighbors of the specified location, based on the current adjacency method. Neighbors are returned in clockwise order, starting with the neighbor in the given starting direction.

Declaration
public IEnumerable<Coord> NeighborsClockwise(int startingX, int startingY, Direction startingDirection = null)
Parameters
Type Name Description
System.Int32 startingX

X-coordinate of location to return neighbors for.

System.Int32 startingY

Y-coordinate of location to return neighbors for.

Direction startingDirection

The neighbor in this direction will be returned first, proceeding clockwise. If null or NONE is specified, the default starting direction is used, which is UP for CARDINALS/EIGHT_WAY, and UP_RIGHT for DIAGONALS.

Returns
Type Description
System.Collections.Generic.IEnumerable<Coord>

All neighbors of the given location.

| Improve this Doc View Source

NeighborsCounterClockwise(Coord, Direction)

Gets all neighbors of the specified location, based on the current adjacency method. Neighbors are returned in counter-clockwise order, starting with the neighbor in the given starting direction.

Declaration
public IEnumerable<Coord> NeighborsCounterClockwise(Coord startingLocation, Direction startingDirection = null)
Parameters
Type Name Description
Coord startingLocation

Location to return neighbors for.

Direction startingDirection

The neighbor in this direction will be returned first, proceeding counter-clockwise. If null or NONE is specified, the default starting direction is used, which is UP for CARDINALS/EIGHT_WAY, and UP_LEFT for DIAGONALS.

Returns
Type Description
System.Collections.Generic.IEnumerable<Coord>

All neighbors of the given location.

| Improve this Doc View Source

NeighborsCounterClockwise(Int32, Int32, Direction)

Gets all neighbors of the specified location, based on the current adjacency method. Neighbors are returned in counter-clockwise order, starting with the neighbor in the given starting direction.

Declaration
public IEnumerable<Coord> NeighborsCounterClockwise(int startingX, int startingY, Direction startingDirection = null)
Parameters
Type Name Description
System.Int32 startingX

X-coordinate of location to return neighbors for.

System.Int32 startingY

Y-coordinate of location to return neighbors for.

Direction startingDirection

The neighbor in this direction will be returned first, proceeding counter-clockwise. If null or NONE is specified, the default starting direction is used, which is UP for CARDINALS/EIGHT_WAY, and UP_LEFT for DIAGONALS.

Returns
Type Description
System.Collections.Generic.IEnumerable<Coord>

All neighbors of the given location.

| Improve this Doc View Source

ToAdjacencyRule(AdjacencyRule.Types)

Gets the AdjacencyRule class instance representing the adjacency type specified.

Declaration
public static AdjacencyRule ToAdjacencyRule(AdjacencyRule.Types adjacencyRuleType)
Parameters
Type Name Description
AdjacencyRule.Types adjacencyRuleType

The enum value for the adjacency method.

Returns
Type Description
AdjacencyRule

The AdjacencyRule class representing the given adjacency method type.

| Improve this Doc View Source

ToString()

Returns a string representation of the AdjacencyRule.

Declaration
public override string ToString()
Returns
Type Description
System.String

A string representation of the AdjacencyRule.

Overrides
System.Object.ToString()

Operators

| Improve this Doc View Source

Equality(AdjacencyRule, AdjacencyRule)

Compares the two AdjacencyRule instances.

Declaration
public static bool operator ==(AdjacencyRule lhs, AdjacencyRule rhs)
Parameters
Type Name Description
AdjacencyRule lhs
AdjacencyRule rhs
Returns
Type Description
System.Boolean

True if the two given AdjacencyRule instances have the same Type, false otherwise.

| Improve this Doc View Source

Inequality(AdjacencyRule, AdjacencyRule)

Compares the two AdjacencyRule instances.

Declaration
public static bool operator !=(AdjacencyRule lhs, AdjacencyRule rhs)
Parameters
Type Name Description
AdjacencyRule lhs
AdjacencyRule rhs
Returns
Type Description
System.Boolean

True if the two given AdjacencyRule instances do NOT have the same Type, false otherwise.

Implements

System.IEquatable<T>

Extension Methods

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