+ /// <summary>\r
+ /// Helper method to get a Direction type from directions.\r
+ /// </summary>\r
+ /// <param name="left">Left.</param>\r
+ /// <param name="right">Right.</param>\r
+ /// <param name="up">Up.</param>\r
+ /// <param name="down">Down.</param>\r
+ /// <returns>The direction.</returns>\r
+ public static Direction GetDirection(bool left, bool right, bool up, bool down)\r
+ {\r
+ if (left && !right)\r
+ {\r
+ if (up) return Direction.UpperLeft;\r
+ else if (down) return Direction.LowerLeft;\r
+ else return Direction.Left;\r
+ }\r
+ else if (right && !left)\r
+ {\r
+ if (up) return Direction.UpperRight;\r
+ else if (down) return Direction.LowerRight;\r
+ else return Direction.Right;\r
+ }\r
+ else if (up) return Direction.Up;\r
+ else if (down) return Direction.Down;\r
+ else return Direction.None;\r
+ }\r
+\r