Exemplo n.º 1
0
        public Tile GetTile(int x, int y)
        {
            //int newX = x;
            //int newY = y;

            //if (x < 0)
            //    newX = Width - 1;
            //if (x >= Width)
            //    newX = 0;
            //if (y <0 )
            //    newY = Height - 1;
            //if (y >= Height)
            //    newY = 0;

            if (x < 0)
            {
                return(Left.GetTile(Width - 1, y));
            }

            if (x >= Width)
            {
                return(Right.GetTile(0, y));
            }

            if (y >= Height)
            {
                return(Down.GetTile(x, 0));
            }

            if (y < 0)
            {
                return(Up.GetTile(x, Height - 1));
            }
            return(tiles[x, y]);
        }