43 lines
839 B
C#
43 lines
839 B
C#
[Flags]
|
|
public enum Direction
|
|
{
|
|
N = 1,
|
|
NE = 2,
|
|
E = 4,
|
|
SE = 8,
|
|
S = 16,
|
|
SW = 32,
|
|
W = 64,
|
|
NW = 128,
|
|
Horizontal = E | W,
|
|
Vertical = N | S,
|
|
Cardinal = Horizontal | Vertical,
|
|
RisingDiagonal = NE | SW,
|
|
FallingDiagonal = NW | SE,
|
|
Diagonal = RisingDiagonal | FallingDiagonal,
|
|
All = Cardinal | Diagonal,
|
|
Left = W,
|
|
Right = E,
|
|
Up = N,
|
|
Down = S,
|
|
Forward = Right,
|
|
Backward = Left
|
|
}
|
|
|
|
public static class DirectionProvider
|
|
{
|
|
public static Direction[] GetAllDirections()
|
|
{
|
|
var directions = new Direction[] {
|
|
Direction.N,
|
|
Direction.NE,
|
|
Direction.E,
|
|
Direction.SE,
|
|
Direction.S,
|
|
Direction.SW,
|
|
Direction.W,
|
|
Direction.NW
|
|
};
|
|
return directions;
|
|
}
|
|
} |