Если я не ошибаюсь, вы хотите добиться того, чтобы вы создали карту с указанным вами массивом. Если это так, вот способ сделать это:
- Прежде всего, создайте сетку:
int[,] grid = new int[,]
{
//just 2x2 grid, for example
{0, 1,},
{1, 2,},
}
- Далее в розыгрыше на основе сетки, созданной на шаге 1:
public void Draw(SpriteBatch spriteBatch)
{
spriteBatch.Begin();
for (int i = 0; i < grid.GetLength(1); i++)//width
{
for (int j = 0; j < grid.GetLength(0); j++)//height
{
int textureIndex = grid[j, i];
if (textureIndex == -1)
continue;
Texture2D texture = tileTextures[textureIndex];//list of textures
spriteBatch.Draw(texture, new Rectangle(
i * 60, j * 60, 60, 60), Color.White);
}
}
spriteBatch.End();
}