no overlap requirement
This commit is contained in:
@@ -111,7 +111,7 @@ namespace Escape_Room_Engine.Engine.Scripts
|
||||
}
|
||||
|
||||
// orient puzzle
|
||||
HashSet<Orientation> orientationCandidates = Module.EveryOrientation;
|
||||
var orientationCandidates = Module.EveryOrientation;
|
||||
Logger.Log($"orientation candidatesA: {string.Join(",", orientationCandidates.ToList().ConvertAll(c => c.ToString()))}", LogType.RequirementResolution);
|
||||
puzzle._description.RequirementsOfType<OrientationRequirement>().ForEach(requirement =>
|
||||
orientationCandidates.IntersectWith(requirement.OrientationCandidates(puzzle, space)));
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
using System.Collections.Generic;
|
||||
using Escape_Room_Engine.Engine.Scripts.Modules;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Escape_Room_Engine.Engine.Scripts.Requirements
|
||||
{
|
||||
[CreateAssetMenu(menuName = "Requirements/No Overlap")]
|
||||
public class NoOverlap : PlacementRequirement
|
||||
{
|
||||
public override IEnumerable<Vector2Int> PlacementCandidates(Module module, Space space)
|
||||
{
|
||||
var edgePositions = space.rrDimensions.EveryPosition;
|
||||
|
||||
space.Modules.ForEach(m => edgePositions.Remove(m.SrPosition));
|
||||
|
||||
return edgePositions;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 58ae9c09c887475d833d2cd4ee4ccffb
|
||||
timeCreated: 1667881856
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Escape_Room_Engine.Engine.Scripts.Modules;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Escape_Room_Engine.Engine.Scripts.Requirements
|
||||
{
|
||||
|
||||
@@ -10,9 +10,9 @@ namespace Escape_Room_Engine.Engine.Scripts
|
||||
/// The room relative (<i>RR</i>) dimensions of this space.
|
||||
/// </summary>
|
||||
internal readonly Dimensions rrDimensions;
|
||||
internal List<Module> Modules { get; } = new(2);
|
||||
|
||||
private GameObject _spaceObject;
|
||||
private List<Module> _modules = new(2);
|
||||
|
||||
internal Space(Dimensions rrDimensions, Passage entrance)
|
||||
{
|
||||
@@ -26,7 +26,7 @@ namespace Escape_Room_Engine.Engine.Scripts
|
||||
|
||||
internal void AddModule(Module module)
|
||||
{
|
||||
_modules.Add(module);
|
||||
Modules.Add(module);
|
||||
}
|
||||
|
||||
internal void InstantiateSpace(Transform parent, string name)
|
||||
@@ -42,7 +42,7 @@ namespace Escape_Room_Engine.Engine.Scripts
|
||||
meshRenderer.material = Engine.DefaultEngine.roomMaterial;
|
||||
|
||||
// instantiate all modules inside this space
|
||||
_modules.ForEach(module => module.InstantiateModule(_spaceObject.transform));
|
||||
Modules.ForEach(module => module.InstantiateModule(_spaceObject.transform));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user