예제 #1
0
        /// <summary>
        /// Overrided method to Generate empty Map
        /// </summary>
        /// <param name="Chunk">Chunk to generate in</param>
        public override void Generate(Chunk Chunk)
        {
            for (int y = 0; y < Chunk.position.Height / Chunk.tileSize; y++)
            {
                for (int x = 0; x < Chunk.position.Width / Chunk.tileSize; x++)
                {
                    Chunk.SetTile(x, y, new Tile(new Rectangle(Chunk.position.X + x * Chunk.tileSize, Chunk.position.Y + y * Chunk.tileSize, Chunk.tileSize, Chunk.tileSize), "dungFloor", 30));
                }
            }

            for (int x = 2; x <= 10; x++)
            {
                Chunk.SetTile(x, 2, new Tile(new Rectangle(Chunk.position.X + x * Chunk.tileSize, Chunk.position.Y + 2 * Chunk.tileSize, Chunk.tileSize, Chunk.tileSize), "dungWall", 0));
                Chunk.SetTile(x, 10, new Tile(new Rectangle(Chunk.position.X + x * Chunk.tileSize, Chunk.position.Y + 10 * Chunk.tileSize, Chunk.tileSize, Chunk.tileSize), "dungWall", 0));
            }

            for (int y = 2; y <= 10; y++)
            {
                Chunk.SetTile(2, y, new Tile(new Rectangle(Chunk.position.X + 2 * Chunk.tileSize, Chunk.position.Y + y * Chunk.tileSize, Chunk.tileSize, Chunk.tileSize), "dungWall", 0));
                Chunk.SetTile(10, y, new Tile(new Rectangle(Chunk.position.X + 10 * Chunk.tileSize, Chunk.position.Y + y * Chunk.tileSize, Chunk.tileSize, Chunk.tileSize), "dungWall", 0));
            }
        }
예제 #2
0
        void ConvertDungeon(Chunk C)
        {
            for (int y = 0; y < ymax; y++)
               {
               for (int x = 0; x < xmax; x++)
               {
                   switch (GetCellType(x, y))
                   {
                       case Tile.Corridor:
                           C.SetTile(x, y, new MapManager.Tile(new Rectangle(C.position.X + x * C.tileSize, C.position.Y + y * C.tileSize, C.tileSize, C.tileSize), "dungFloor", 30));
                           break;
                       case Tile.DirtFloor:
                           C.SetTile(x, y, new MapManager.Tile(new Rectangle(C.position.X + x * C.tileSize, C.position.Y + y * C.tileSize, C.tileSize, C.tileSize), "dungFloor", 30));
                           break;
                       case Tile.DirtWall:
                           C.SetTile(x, y, new MapManager.Tile(new Rectangle(C.position.X + x * C.tileSize, C.position.Y + y * C.tileSize, C.tileSize, C.tileSize), "dungWall", 0));
                           break;
                       case Tile.StoneWall:
                           C.SetTile(x, y, new MapManager.Tile(new Rectangle(C.position.X + x * C.tileSize, C.position.Y + y * C.tileSize, C.tileSize, C.tileSize), "dungWall", 0));
                           break;
                       case Tile.Unused:
                           C.SetTile(x, y, new MapManager.Tile(new Rectangle(C.position.X + x * C.tileSize, C.position.Y + y * C.tileSize, C.tileSize, C.tileSize), "dungWall", 0));
                           break;
                       case Tile.Upstairs:
                           C.SetTile(x, y, new MapManager.Tile(new Rectangle(C.position.X + x * C.tileSize, C.position.Y + y * C.tileSize, C.tileSize, C.tileSize), "dungFloor", 30));
                           C.map.Player.Position = new Rectangle(x * C.tileSize, y * C.tileSize,C.tileSize,C.tileSize);
                           break;
                       default:
                           C.SetTile(x, y, new MapManager.Tile(new Rectangle(C.position.X + x * C.tileSize, C.position.Y + y * C.tileSize, C.tileSize, C.tileSize), "dungFloor", 30));
                           break;

                   }
               }
               }
        }