puzzle flow

This commit is contained in:
2022-11-11 16:25:25 +01:00
parent c4f63ce3be
commit 990c7205ba
8 changed files with 128 additions and 23 deletions

View File

@@ -17,9 +17,11 @@ namespace Escape_Room_Engine.Engine.Scripts
internal List<Module> Modules { get; } = new(2);
private GameObject _spaceObject;
private readonly Room _room;
internal Space(Passage entrance)
internal Space(Room room, Passage entrance)
{
_room = room;
rrDimensions = GenerateSpaceDimensions(
entrance,
Engine.DefaultEngine.config.minRoomSize,
@@ -34,6 +36,11 @@ namespace Escape_Room_Engine.Engine.Scripts
internal void AddModule(Module module)
{
Modules.Add(module);
if (module is PuzzleModule puzzleModule)
{
_room.AddPuzzle(puzzleModule);
}
}
internal bool AddModuleWithRequirements(Module module)
@@ -95,11 +102,6 @@ namespace Escape_Room_Engine.Engine.Scripts
/// <param name="rrPosition">The room relative (<i>RR</i>) position that should be converted to a space relative (<i>SR</i>) position.</param>
internal Vector2Int ToSpaceRelative(Vector2Int rrPosition) => rrPosition - rrDimensions.Position;
internal void Destroy()
{
Object.Destroy(_spaceObject);
}
/// <summary>
/// Generate space dimensions that fit the required size constraints and cover the position of the entrance.
/// </summary>