コード例 #1
0
ファイル: VerticalArea.cs プロジェクト: treytomes/ASCIIWorld2
		protected override void Split(RoomGenerator roomGenerator)
		{
			var minAreaHeight = roomGenerator.MinHeight + 2;
			var maxAreaHeight = roomGenerator.MaxHeight + 2;

			if (Bounds.Height < minAreaHeight)
			{
				return;
			}
			else if (Bounds.Height > maxAreaHeight)
			{
				var splitRow = Random.Next(minAreaHeight, Bounds.Height - minAreaHeight + 1);

				var height1 = splitRow;
				var height2 = Bounds.Height - splitRow + 1;

				if (height1 >= minAreaHeight)
				{
					SubArea1 = new HorizontalArea(roomGenerator, Random, Bounds.X, Bounds.Y, Bounds.Width, height1);
				}

				if (height2 >= minAreaHeight)
				{
					SubArea2 = new HorizontalArea(roomGenerator, Random, Bounds.X, Bounds.Y + splitRow - 1, Bounds.Width, height2);
				}
			}
		}
コード例 #2
0
        protected override void Split(RoomGenerator roomGenerator)
        {
            var minAreaHeight = roomGenerator.MinHeight + 2;
            var maxAreaHeight = roomGenerator.MaxHeight + 2;

            if (Bounds.Height < minAreaHeight)
            {
                return;
            }
            else if (Bounds.Height > maxAreaHeight)
            {
                var splitRow = Random.Next(minAreaHeight, Bounds.Height - minAreaHeight + 1);

                var height1 = splitRow;
                var height2 = Bounds.Height - splitRow + 1;

                if (height1 >= minAreaHeight)
                {
                    SubArea1 = new HorizontalArea(roomGenerator, Random, Bounds.X, Bounds.Y, Bounds.Width, height1);
                }

                if (height2 >= minAreaHeight)
                {
                    SubArea2 = new HorizontalArea(roomGenerator, Random, Bounds.X, Bounds.Y + splitRow - 1, Bounds.Width, height2);
                }
            }
        }
コード例 #3
0
		public override Chunk Generate(IProgress<string> progress, int chunkX, int chunkY)
		{
			Reseed(chunkX, chunkY);

			var chunk = new Chunk(Width, Height);
			Fill(chunk, ChunkLayer.Floor, _floorId);
			Fill(chunk, ChunkLayer.Blocking, _wallId);

			_roomGenerator.Reset();

			var dungeonArea = new HorizontalArea(_roomGenerator, Random, 0, 0, Width, Height);
			RenderRooms(chunk, dungeonArea, progress);
			RenderCorridors(chunk, dungeonArea, progress);

			DecorateWithDoors(chunk, dungeonArea, progress);

			return chunk;
		}
コード例 #4
0
        public override Chunk Generate(IProgress <string> progress, int chunkX, int chunkY)
        {
            Reseed(chunkX, chunkY);

            var chunk = new Chunk(Width, Height);

            Fill(chunk, ChunkLayer.Floor, _floorId);
            Fill(chunk, ChunkLayer.Blocking, _wallId);

            _roomGenerator.Reset();

            var dungeonArea = new HorizontalArea(_roomGenerator, Random, 0, 0, Width, Height);

            RenderRooms(chunk, dungeonArea, progress);
            RenderCorridors(chunk, dungeonArea, progress);

            DecorateWithDoors(chunk, dungeonArea, progress);

            return(chunk);
        }