orient entrance to reflect previous exit orientation

This commit is contained in:
2022-11-07 16:22:00 +01:00
parent 1a1e7f87a0
commit 9e748a0f38
4 changed files with 19 additions and 19 deletions

View File

@@ -77,6 +77,7 @@ namespace Escape_Room_Engine.Engine.Scripts
Random.Range(0, rrDimensions.width),
Random.Range(0, rrDimensions.length)
));
exitDoor.orientation = Module.EveryOrientation.RandomElement();
var exit = new Passage(exitDoor);
space.AddModule(exitDoor);
@@ -95,7 +96,7 @@ namespace Escape_Room_Engine.Engine.Scripts
// place puzzle
var placementCandidates = space.rrDimensions.EveryPosition;
puzzle._description.RequirementsOfType<PlacementRequirement>().ForEach(requirement =>
puzzle.description.RequirementsOfType<PlacementRequirement>().ForEach(requirement =>
placementCandidates.IntersectWith(requirement.PlacementCandidates(puzzle, space)));
Logger.Log($"placement candidates: {string.Join(", ", placementCandidates.ToList().ConvertAll(c => c.ToString()))}", LogType.RequirementResolution);
@@ -112,15 +113,14 @@ namespace Escape_Room_Engine.Engine.Scripts
// orient puzzle
var orientationCandidates = Module.EveryOrientation;
Logger.Log($"orientation candidatesA: {string.Join(",", orientationCandidates.ToList().ConvertAll(c => c.ToString()))}", LogType.RequirementResolution);
puzzle._description.RequirementsOfType<OrientationRequirement>().ForEach(requirement =>
puzzle.description.RequirementsOfType<OrientationRequirement>().ForEach(requirement =>
orientationCandidates.IntersectWith(requirement.OrientationCandidates(puzzle, space)));
Logger.Log($"orientation candidates: {string.Join(",", orientationCandidates.ToList().ConvertAll(c => c.ToString()))}", LogType.RequirementResolution);
if (orientationCandidates.Count > 0)
{
puzzle.Orient(orientationCandidates.RandomElement());
puzzle.orientation = orientationCandidates.RandomElement();
}
else
{