示例#1
0
    public static Tile[,,] IdsToTiles(int[][][] ids)
    {
        int xSizes = ids.GetLength(0);
        int ySizes = ids[0].GetLength(0);
        int zSizes = ids[0][0].GetLength(0);

        Tile[,,] tiles = new Tile[xSizes, ySizes, zSizes];

        for (int y = 0; y < ySizes; y++)
        {
            for (int x = 0; x < xSizes; x++)
            {
                for (int z = 0; z < zSizes; z++)
                {
                    if (z == 0)
                    {
                        tiles[x, y, z] = TerrainTile.GetTerrainTileOfID(ids[x][y][z]);
                    }
                    if (z == 1)
                    {
                        Item item = Item.GetItemOfID(ids[x][y][z]);
                        if (item != null)
                        {
                            tiles[x, y, z] = new ItemTile(item);
                        }
                    }
                }
            }
        }

        return(tiles);
    }