示例#1
0
文件: Map.cs 项目: myko/Eternia
        public Map(int width, int height)
        {
            Width = width;
            Height = height;
            Tiles = new MapTile[width * height];

            Randomizer r = new Randomizer();
            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    Tiles[x + y * width] = new MapTile();
                    Tiles[x + y * width].Height = (x == 0 || y == 0 || x == width - 1 || y == height - 1) ? 4 : 0;
                    Tiles[x + y * width].FloorTexture = r.From(@"MapTiles\grass1", @"MapTiles\grass2", @"MapTiles\dirt1", @"MapTiles\dirt2", @"MapTiles\dirt3", @"MapTiles\sand1", @"MapTiles\paving1");
                    Tiles[x + y * width].WallTexture = r.From(@"MapTiles\rock1");
                }
            }

            UpdateTileReferences();
        }