Struct Direction8
One of the following 8 directions:
- Up
- Down
- Left
- Right
- Up-Right
- Up-Left
- Down-Right
- Down-Left
public readonly struct Direction8 : IEquatable<Direction8>
- Implements
- Inherited Members
- Extension Methods
Fields
All
All 8 directions.
public static readonly IEnumerable<Direction8> All
Field Value
Diagonals
public static readonly IEnumerable<Direction8> Diagonals
Field Value
Down
The direction (0, -1)
.
public static readonly Direction8 Down
Field Value
DownLeft
The direction (-1, -1)
.
public static readonly Direction8 DownLeft
Field Value
DownRight
The direction (1, -1)
.
public static readonly Direction8 DownRight
Field Value
Left
The direction (-1, 0)
.
public static readonly Direction8 Left
Field Value
Right
The direction (1, 0)
.
public static readonly Direction8 Right
Field Value
Up
The direction (0, 1)
.
public static readonly Direction8 Up
Field Value
UpDownLeftRight
public static readonly IEnumerable<Direction8> UpDownLeftRight
Field Value
UpLeft
The direction (-1, 1)
.
public static readonly Direction8 UpLeft
Field Value
UpRight
The direction (1, 1)
.
public static readonly Direction8 UpRight
Field Value
Methods
Deconstruct(out int, out int)
public void Deconstruct(out int x, out int y)
Parameters
Equals(Direction8)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Direction8 other)
Parameters
other
Direction8An object to compare with this object.
Returns
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
Parameters
obj
objectThe object to compare with the current instance.
Returns
- bool
true if
obj
and this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Operators
operator ==(Direction8, Direction8)
public static bool operator ==(Direction8 a, Direction8 b)
Parameters
a
Direction8b
Direction8
Returns
explicit operator Direction8(IntVector2)
Converts an IntVector2 with supNorm 1 into the corresponding Direction8.
public static explicit operator Direction8(IntVector2 direction)
Parameters
direction
IntVector2
Returns
Exceptions
- ArgumentException
direction
does not have supNorm 1.
implicit operator IntVector2(Direction8)
Converts the Direction8 into the corresponding IntVector2 with supNorm 1.
public static implicit operator IntVector2(Direction8 direction)
Parameters
direction
Direction8
Returns
operator !=(Direction8, Direction8)
public static bool operator !=(Direction8 a, Direction8 b)
Parameters
a
Direction8b
Direction8
Returns
operator -(Direction8)
Returns the direction rotated 180 degrees.
public static Direction8 operator -(Direction8 direction)
Parameters
direction
Direction8