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