generic puzzle module
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user