Beispiel #1
0
		public static Level Generate(int width, int height)
		{
			DungeonGenerator.Instance.GenerateHauberkDungeon(width, height, 195000, 5, 5, 50, false, true);

			var tileData = DungeonGenerator._dungeon;
			var map = new Map (width, height);
			var tiles = new Tile[width, height];

			for (int x = 0; x < width; x++)
			{
				for (int y = 0; y < height; y++)
				{
					switch (tileData[x, y])
					{
						case TileType.Floor: 
							map.SetCellProperties (x, y, true, true); 
							break;
						case TileType.RoomFloor: 
							map.SetCellProperties(x, y, true, true); 
							break;
						case TileType.Wall: 
							map.SetCellProperties(x, y, false, false); 
							break;
						case TileType.Door: 
							map.SetCellProperties (x, y, false, false); 
							break;
					}
					tiles [x, y] = new Tile (tileData [x, y]);
				}
			}

			return new Level (map, tiles);
		}
Beispiel #2
0
		private Level(IMap map, Tile[,] tiles)
		{
			_map = map;
			_tiles = tiles;
			_gameObjects = new List<GameObject> ();
			Width = map.Width;
			Height = map.Height;
			Level.Camera.Level = this;
		}
Beispiel #3
0
		// Center the camera on a specific cell in the map
		public void CenterOn( Tile tile )
		{
			Position = CenteredPosition(tile.CellData, true );
		}
Beispiel #4
0
		public Tile SetTileProperties(Tile tile, bool isWalkable, bool isTransparent, bool isExplored)
		{
			_map.SetCellProperties (tile.CellData.X, tile.CellData.Y, isTransparent, isWalkable, isExplored);
			return GetTile (tile.CellData.X, tile.CellData.Y);
		}