Added entrances to map print and added debugging info to print.

This commit is contained in:
Max 2025-02-04 15:32:33 +01:00
parent 9c02b11299
commit 64fbb67397

View file

@ -16,6 +16,7 @@ namespace DungeonGenerator
private List<Room> _monsterRooms = new List<Room>();
private int _xLength = 40;
private int _yLength = 28;
private List<Point> _entrancePoints;
public void GenerateDungeon(int length, float monsterRoomRatio)
{
@ -23,9 +24,9 @@ namespace DungeonGenerator
_yLength = 28;
Random random = new Random();
List<Point> entrancePoints = GenerateEntrancePoints(_xLength, _yLength, random.Next(1,4));
_entrancePoints = GenerateEntrancePoints(_xLength, _yLength, random.Next(1,4));
EvenDisperser disperser = new EvenDisperser(_xLength, _yLength, entrancePoints); //TODO calculate L and W from length
EvenDisperser disperser = new EvenDisperser(_xLength, _yLength, _entrancePoints); //TODO calculate L and W from length
int numberOfMonsterRooms = 7; // TODO: Calculate from ratio
for (var i = 0; i < numberOfMonsterRooms; i ++)
{
@ -45,7 +46,11 @@ namespace DungeonGenerator
{
for (int y = 0; y < _yLength; y++)
{
if (_monsterRooms.Any(room => room.PositionOfTopLeft.Equals(new Point(x,y))))
if (_entrancePoints.Contains(new Point(x, y)))
{
mapMatrix[x, y] = '*';
}
else if (_monsterRooms.Any(room => room.PositionOfTopLeft.Equals(new Point(x,y))))
{
mapMatrix[x, y] = 'X';
}
@ -66,7 +71,11 @@ namespace DungeonGenerator
sb.Append(Environment.NewLine);
}
Debug.Log(sb.ToString());
Debug.Log($"{DateTime.Now}{Environment.NewLine}" +
$"X Length: {_xLength}{Environment.NewLine}" +
$"Y Length: {_yLength}{Environment.NewLine}" +
$"Monster Rooms: {_monsterRooms.Count}{Environment.NewLine}" +
sb.ToString());
}
private enum Side
@ -149,7 +158,7 @@ namespace DungeonGenerator
// Add the rest of the points for this entrance line to the bottom right side.
for (var i = 0; i < pointsPerLine; i++)
{
entrancePoints.Add(new Point(xLengthOfDungeon - 1, (yLengthOfDungeon - 1) - i));
entrancePoints.Add(new Point(xLengthOfDungeon - 1, (yLengthOfDungeon - 2) - i));
}
break;
case 1: