public static Point GetNextStep(DirectionType direction, int steps = 1) { int x = 0, y = 0; if (direction.HasFlag(DirectionType.West)) { x = -steps; } if (direction.HasFlag(DirectionType.East)) { x = +steps; } if (direction.HasFlag(DirectionType.North)) { y = -steps; } if (direction.HasFlag(DirectionType.South)) { y = +steps; } return(new Point(x, y)); }
public static bool IsBottom(this DirectionType directionType) { return(directionType.HasFlag(DirectionType.Bottom) || directionType.HasFlag(DirectionType.LeftBottom) || directionType.HasFlag(DirectionType.RightBottom)); }
public static bool IsRight(this DirectionType directionType) { return(directionType.HasFlag(DirectionType.Right) || directionType.HasFlag(DirectionType.RightTop) || directionType.HasFlag(DirectionType.RightBottom)); }
public static bool IsTop(this DirectionType directionType) { return(directionType.HasFlag(DirectionType.Top) || directionType.HasFlag(DirectionType.LeftTop) || directionType.HasFlag(DirectionType.RightTop)); }
public static bool IsLeft(this DirectionType directionType) { return(directionType.HasFlag(DirectionType.Left) || directionType.HasFlag(DirectionType.LeftTop) || directionType.HasFlag(DirectionType.LeftBottom)); }