using System.Collections.Generic; using EscapeRoomEngine.Engine.Runtime.Modules; using NaughtyAttributes; using UnityEngine; namespace EscapeRoomEngine.Engine.Runtime.Requirements { [CreateAssetMenu(menuName = "Requirements/No Overlap")] public class NoOverlap : PlacementRequirement { [InfoBox("A module relative position will be oriented with the module (e.g. (0, 1) is always in front of the module).")] [Label("Reserved Positions (Module Relative)")] public List mrReservedPositions; protected override IEnumerable GenerateCandidates(Module module, Space space) { var candidates = space.rrDimensions.EveryPosition; space.AllModules.ForEach(m => { candidates.Remove(m.SrPosition); m.description.placementRequirements .FindAll(r => r is NoOverlap) .ForEach(r => ((NoOverlap)r).mrReservedPositions .ForEach(p => candidates.Remove(m.ToSpaceRelative(p)))); }); return candidates; } } }