protected Coordinate GetNeighborCoordinate(Coordinate position, WangDirection direction) { int x = position.X; int y = position.Y; return(direction switch { WangDirection.North => new Coordinate(x, y - 1), WangDirection.NorthEast => new Coordinate(x + 1, y - 1), WangDirection.East => new Coordinate(x + 1, y), WangDirection.SouthEast => new Coordinate(x + 1, y + 1), WangDirection.South => new Coordinate(x, y + 1), WangDirection.SouthWest => new Coordinate(x - 1, y + 1), WangDirection.West => new Coordinate(x - 1, y), WangDirection.NorthWest => new Coordinate(x - 1, y - 1), _ => throw new ArgumentOutOfRangeException(nameof(direction), direction, null) });
protected (T, Coordinate, WangDirection) GetNeighborTile(Coordinate position, WangDirection direction) { var neighbor = GetNeighborCoordinate(position, direction); return(GetTileAt(neighbor.X, neighbor.Y), neighbor, direction); }