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));
        }
Exemplo n.º 2
0
 public static bool IsBottom(this DirectionType directionType)
 {
     return(directionType.HasFlag(DirectionType.Bottom) || directionType.HasFlag(DirectionType.LeftBottom) || directionType.HasFlag(DirectionType.RightBottom));
 }
Exemplo n.º 3
0
 public static bool IsRight(this DirectionType directionType)
 {
     return(directionType.HasFlag(DirectionType.Right) || directionType.HasFlag(DirectionType.RightTop) || directionType.HasFlag(DirectionType.RightBottom));
 }
Exemplo n.º 4
0
 public static bool IsTop(this DirectionType directionType)
 {
     return(directionType.HasFlag(DirectionType.Top) || directionType.HasFlag(DirectionType.LeftTop) || directionType.HasFlag(DirectionType.RightTop));
 }
Exemplo n.º 5
0
 public static bool IsLeft(this DirectionType directionType)
 {
     return(directionType.HasFlag(DirectionType.Left) || directionType.HasFlag(DirectionType.LeftTop) || directionType.HasFlag(DirectionType.LeftBottom));
 }