no overlap requirement
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 58ae9c09c887475d833d2cd4ee4ccffb, type: 3}
|
||||
m_Name: No Overlap
|
||||
m_EditorClassIdentifier:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 43eb2a566a244964aa3a3319eaafe1a8
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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