generic puzzle module

This commit is contained in:
2022-11-07 11:12:00 +01:00
parent 511002833c
commit 7e9331f612
24 changed files with 292 additions and 25 deletions

View File

@@ -27,11 +27,13 @@ namespace Escape_Room_Engine.Engine.Scripts
public Material roomMaterial;
[Range(0, 10)] public int minPuzzleCount, maxPuzzleCount;
[Tooltip("The minimum size that should be allowed for rooms.")] public Vector2Int minRoomSize;
[Tooltip("The size of the physical play space available to the engine.")] public Vector2Int playSpace;
public ModuleDescription genericModule;
public DoorModuleDescription spawnDoor;
public List<DoorModuleDescription> exitDoorTypes;
public List<PuzzleModuleDescription> puzzleTypes;
private int NumberOfRooms => _rooms.Count;
@@ -77,6 +79,17 @@ namespace Escape_Room_Engine.Engine.Scripts
var exit = new Passage(exitDoor);
space.AddModule(exitDoor);
// add puzzles
for (var i = 0; i < Utilities.Utilities.RandomInclusive(minPuzzleCount, maxPuzzleCount); i++)
{
var puzzle = new PuzzleModule(space, puzzleTypes.RandomElement());
puzzle.Place(new Vector2Int(
Random.Range(0, rrDimensions.width),
Random.Range(0, rrDimensions.length)
));
space.AddModule(puzzle);
}
room.AddSpace(space, exit);
}