module relations and module staging

This commit is contained in:
2022-11-21 11:40:54 +01:00
parent 95e447e8ef
commit eeb90ac24c
7 changed files with 69 additions and 21 deletions

View File

@@ -16,7 +16,7 @@ namespace EscapeRoomEngine.Engine.Runtime.Requirements
{
var candidates = space.rrDimensions.EveryPosition;
space.Modules.ForEach(m =>
space.AllModules.ForEach(m =>
{
candidates.Remove(m.SrPosition);
m.description.placementRequirements

View File

@@ -32,7 +32,7 @@ namespace EscapeRoomEngine.Engine.Runtime.Requirements
// ReSharper disable once RedundantIfElseBlock
else
{
Logger.Log("Could not find suitable orientation for module", LogType.ModulePlacement);
Logger.Log("Could not find suitable orientation for module", LogType.RequirementResolution);
return false;
}
}

View File

@@ -35,7 +35,7 @@ namespace EscapeRoomEngine.Engine.Runtime.Requirements
// ReSharper disable once RedundantIfElseBlock
else
{
Logger.Log($"Could not find suitable placement for {module}", LogType.ModulePlacement);
Logger.Log($"Could not find suitable placement for {module}", LogType.RequirementResolution);
return false;
}
}

View File

@@ -1,6 +1,5 @@
using System.Collections.Generic;
using EscapeRoomEngine.Engine.Runtime.Modules;
using UnityEngine;
using Logger = EscapeRoomEngine.Engine.Runtime.Utilities.Logger;
using LogType = EscapeRoomEngine.Engine.Runtime.Utilities.LogType;
@@ -14,7 +13,6 @@ namespace EscapeRoomEngine.Engine.Runtime.Requirements
public static bool CheckPreconditions(Module module, Space space)
{
Debug.Log($"{module}, {module.description.preconditionRequirements}");
if (module.description.preconditionRequirements.Count == 0)
{
// don't evaluate requirements if there are none
@@ -31,7 +29,7 @@ namespace EscapeRoomEngine.Engine.Runtime.Requirements
preconditionsMet
? $"Preconditions for {module} satisfied"
: $"Could not satisfy preconditions for {module}",
LogType.ModulePlacement);
LogType.RequirementResolution);
return preconditionsMet;
}

View File

@@ -14,7 +14,10 @@ namespace EscapeRoomEngine.Engine.Runtime.Requirements
protected override IEnumerable<bool> GenerateCandidates(Module module, Space space)
{
return new []{ space.AddModuleWithRequirements(Module.CreateModuleByType(space, relatedModule)) };
var newModule = Module.CreateModuleByType(space, relatedModule);
module.relatedModules.Add(newModule);
return new []{ space.StageModuleWithRequirements(newModule) };
}
}
}