Struct Direction
- Namespace
- Gloam.Core.Primitives
- Assembly
- Gloam.Core.dll
Represents a direction in 2D space using 8-directional movement (cardinal and diagonal directions).
public readonly struct Direction : IEquatable<Direction>
- Implements
- Inherited Members
Constructors
Direction(int, int)
public Direction(int x, int y)
Parameters
Fields
All8
public static readonly Direction[] All8
Field Value
East
public static readonly Direction East
Field Value
North
public static readonly Direction North
Field Value
NorthEast
public static readonly Direction NorthEast
Field Value
NorthWest
public static readonly Direction NorthWest
Field Value
South
public static readonly Direction South
Field Value
SouthEast
public static readonly Direction SouthEast
Field Value
SouthWest
public static readonly Direction SouthWest
Field Value
West
public static readonly Direction West
Field Value
Properties
X
public int X { get; }
Property Value
Y
public int Y { get; }
Property Value
Methods
AsVector2()
public Vector2 AsVector2()
Returns
Equals(Direction)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Direction other)
Parameters
other
DirectionAn 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 +(Position, Direction)
public static Position operator +(Position position, Direction direction)
Parameters
Returns
operator ==(Direction, Direction)
public static bool operator ==(Direction left, Direction right)
Parameters
Returns
implicit operator Vector2(Direction)
public static implicit operator Vector2(Direction direction)
Parameters
direction
Direction
Returns
operator !=(Direction, Direction)
public static bool operator !=(Direction left, Direction right)