Пример #1
0
        public static bool IsInGivenDirectionFrom(this BoardLocation source, BoardLocation target, Direction direction)
        {
            switch (direction)
            {
            case Direction.East:
                return(source.IsEastFrom(target));

            case Direction.North:
                return(source.IsNorthFrom(target));

            case Direction.NorthEast:
                return(source.IsNorthEastFrom(target));

            case Direction.NorthWest:
                return(source.IsNorthWestFrom(target));

            case Direction.South:
                return(source.IsSouthFrom(target));

            case Direction.SouthEast:
                return(source.IsSouthEastFrom(target));

            case Direction.SouthWest:
                return(source.IsSouthWestFrom(target));

            case Direction.West:
                return(source.IsWestFrom(target));

            default:
                return(false);
            }
        }