Fixed an issue where some room slots could not be blocked.
修复某些房间槽无法被堵住的问题。
This commit is contained in:
parent
1e019339d8
commit
4ae8a5d470
|
@ -282,7 +282,10 @@ public static class MapGenerator
|
|||
continue;
|
||||
}
|
||||
|
||||
await PlaceRoomAndAddRecord(roomNodeData.Id, roomPlacementData, roomDictionary);
|
||||
if (await PlaceRoomAndAddRecord(roomNodeData.Id, roomPlacementData, roomDictionary))
|
||||
{
|
||||
MarkRoomSlot(roomPlacementData);
|
||||
}
|
||||
}
|
||||
|
||||
//Place barriers
|
||||
|
@ -368,6 +371,24 @@ public static class MapGenerator
|
|||
barrier.QueueFree();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>Mark the room slot as matched</para>
|
||||
/// <para>将房间槽标记为已匹配</para>
|
||||
/// </summary>
|
||||
/// <param name="roomPlacementData"></param>
|
||||
private static void MarkRoomSlot(RoomPlacementData roomPlacementData)
|
||||
{
|
||||
if (roomPlacementData.ParentRoomSlot != null)
|
||||
{
|
||||
roomPlacementData.ParentRoomSlot.Matched = true;
|
||||
}
|
||||
|
||||
if (roomPlacementData.NewRoomSlot != null)
|
||||
{
|
||||
roomPlacementData.NewRoomSlot.Matched = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>Place rooms and add mappings</para>
|
||||
/// <para>放置房间,并增加映射</para>
|
||||
|
|
|
@ -219,18 +219,6 @@ public class PatchworkRoomPlacementStrategy : IRoomPlacementStrategy
|
|||
{
|
||||
var index = randomNumberGenerator.Randi() % usableRoomPlacementData.Count;
|
||||
var roomPlacementData = usableRoomPlacementData[(int)index];
|
||||
//Be sure to mark its slot as a match when you use it.
|
||||
//一定要在使用时,将其插槽标记为匹配。
|
||||
if (roomPlacementData.ParentRoomSlot != null)
|
||||
{
|
||||
roomPlacementData.ParentRoomSlot.Matched = true;
|
||||
}
|
||||
|
||||
if (roomPlacementData.NewRoomSlot != null)
|
||||
{
|
||||
roomPlacementData.NewRoomSlot.Matched = true;
|
||||
}
|
||||
|
||||
return roomPlacementData;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user