diff --git a/MLEM/Misc/Direction2.cs b/MLEM/Misc/Direction2.cs
index 036aa05..f33bd4f 100644
--- a/MLEM/Misc/Direction2.cs
+++ b/MLEM/Misc/Direction2.cs
@@ -7,47 +7,49 @@ namespace MLEM.Misc {
///
/// An enum that represents two-dimensional directions.
/// Both straight and diagonal directions are supported.
+ /// There are several extension methods and arrays available in .
///
+ [Flags]
public enum Direction2 {
- ///
- /// The up direction, or -y.
- ///
- Up,
- ///
- /// The right direction, or +x.
- ///
- Right,
- ///
- /// The down direction, or +y.
- ///
- Down,
- ///
- /// The left direction, or -x.
- ///
- Left,
-
- ///
- /// The up and right direction, or +x, -y.
- ///
- UpRight,
- ///
- /// The down and right direction, or +x, +y.
- ///
- DownRight,
- ///
- /// The down and left direction, or -x, +y.
- ///
- DownLeft,
- ///
- /// The up and left direction, or -x, -y.
- ///
- UpLeft,
-
///
/// No direction.
///
- None
+ None = 0,
+
+ ///
+ /// The up direction, or -y.
+ ///
+ Up = 1,
+ ///
+ /// The right direction, or +x.
+ ///
+ Right = 2,
+ ///
+ /// The down direction, or +y.
+ ///
+ Down = 4,
+ ///
+ /// The left direction, or -x.
+ ///
+ Left = 8,
+
+ ///
+ /// The up and right direction, or +x, -y.
+ ///
+ UpRight = Up | Right,
+ ///
+ /// The down and right direction, or +x, +y.
+ ///
+ DownRight = Down | Right,
+ ///
+ /// The up and left direction, or -x, -y.
+ ///
+ UpLeft = Up | Left,
+ ///
+ /// The down and left direction, or -x, +y.
+ ///
+ DownLeft = Down | Left
}
@@ -80,7 +82,7 @@ namespace MLEM.Misc {
/// The direction to query
/// Whether the direction is adjacent
public static bool IsAdjacent(this Direction2 dir) {
- return dir <= Direction2.Left;
+ return dir == Direction2.Up || dir == Direction2.Right || dir == Direction2.Down || dir == Direction2.Left;
}
///
@@ -89,7 +91,7 @@ namespace MLEM.Misc {
/// The direction to query
/// Whether the direction is diagonal
public static bool IsDiagonal(this Direction2 dir) {
- return dir >= Direction2.UpRight && dir <= Direction2.UpLeft;
+ return dir == Direction2.UpRight || dir == Direction2.DownRight || dir == Direction2.UpLeft || dir == Direction2.DownLeft;
}
///