make sure every module is accessible

This commit is contained in:
2022-11-07 20:51:00 +01:00
parent aae5e78082
commit 648919cf5a
13 changed files with 100 additions and 30 deletions

View File

@@ -35,13 +35,16 @@ namespace Escape_Room_Engine.Engine.Scripts
internal bool AddModuleWithRequirements(Module module)
{
var result =
var requirementsFulfilled =
PlacementRequirement.TryPlacing(module, this) &&
OrientationRequirement.TryOrienting(module, this);
AddModule(module);
return result;
if (requirementsFulfilled)
{
AddModule(module);
}
return requirementsFulfilled;
}
internal void InstantiateSpace(Transform parent, string name)
@@ -64,13 +67,11 @@ namespace Escape_Room_Engine.Engine.Scripts
/// Convert a position relative to this space to one relative to the room.
/// </summary>
/// <param name="srPosition">The space relative (<i>SR</i>) position that should be converted to a room relative (<i>RR</i>) position.</param>
/// <returns></returns>
internal Vector2Int ToRoomRelative(Vector2Int srPosition) => srPosition + rrDimensions.Position;
/// <summary>
/// Convert a position relative to the room to one relative to this space.
/// </summary>
/// <param name="rrPosition">The room relative (<i>RR</i>) position that should be converted to a space relative (<i>SR</i>) position.</param>
/// <returns></returns>
internal Vector2Int ToSpaceRelative(Vector2Int rrPosition) => rrPosition - rrDimensions.Position;
private Mesh GenerateMesh()