UNTESTED Implemented connection rooms.

This commit is contained in:
Max 2025-02-07 15:01:41 +01:00
parent 2baa78bd90
commit 1c447ce510
3 changed files with 261 additions and 46 deletions

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using Unity.VisualScripting;
@ -51,6 +52,11 @@ namespace DungeonGenerator
return points;
}
public bool ContainsPoint(Point point)
{
return GetPointsInRoom().Any(p => p.Equals(point));
}
public int GetDistanceToRoom(Room other)
{
Point centerOfRoom = GetCenterOfRoom();
@ -78,6 +84,16 @@ namespace DungeonGenerator
}
}
public IEnumerable<Room> GetAdjacentRooms()
{
return _adjacentRooms.Values.SelectMany(roomList => roomList);
}
public Dictionary<RoomSide, List<Room>> GetAdjacentRoomsDict()
{
return new Dictionary<RoomSide, List<Room>>(_adjacentRooms);
}
// Helper method to get the opposite side
private RoomSide GetOppositeSide(RoomSide side) => side switch
{