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
|
// 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);
|
Logger.Log($"orientation candidatesA: {string.Join(",", orientationCandidates.ToList().ConvertAll(c => c.ToString()))}", LogType.RequirementResolution);
|
||||||
puzzle._description.RequirementsOfType<OrientationRequirement>().ForEach(requirement =>
|
puzzle._description.RequirementsOfType<OrientationRequirement>().ForEach(requirement =>
|
||||||
orientationCandidates.IntersectWith(requirement.OrientationCandidates(puzzle, space)));
|
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 System.Collections.Generic;
|
||||||
using Escape_Room_Engine.Engine.Scripts.Modules;
|
using Escape_Room_Engine.Engine.Scripts.Modules;
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Escape_Room_Engine.Engine.Scripts.Requirements
|
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.
|
/// The room relative (<i>RR</i>) dimensions of this space.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal readonly Dimensions rrDimensions;
|
internal readonly Dimensions rrDimensions;
|
||||||
|
internal List<Module> Modules { get; } = new(2);
|
||||||
|
|
||||||
private GameObject _spaceObject;
|
private GameObject _spaceObject;
|
||||||
private List<Module> _modules = new(2);
|
|
||||||
|
|
||||||
internal Space(Dimensions rrDimensions, Passage entrance)
|
internal Space(Dimensions rrDimensions, Passage entrance)
|
||||||
{
|
{
|
||||||
@@ -26,7 +26,7 @@ namespace Escape_Room_Engine.Engine.Scripts
|
|||||||
|
|
||||||
internal void AddModule(Module module)
|
internal void AddModule(Module module)
|
||||||
{
|
{
|
||||||
_modules.Add(module);
|
Modules.Add(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void InstantiateSpace(Transform parent, string name)
|
internal void InstantiateSpace(Transform parent, string name)
|
||||||
@@ -42,7 +42,7 @@ namespace Escape_Room_Engine.Engine.Scripts
|
|||||||
meshRenderer.material = Engine.DefaultEngine.roomMaterial;
|
meshRenderer.material = Engine.DefaultEngine.roomMaterial;
|
||||||
|
|
||||||
// instantiate all modules inside this space
|
// instantiate all modules inside this space
|
||||||
_modules.ForEach(module => module.InstantiateModule(_spaceObject.transform));
|
Modules.ForEach(module => module.InstantiateModule(_spaceObject.transform));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1233,8 +1233,8 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
roomMaterial: {fileID: 2100000, guid: 39e2ed014eda5d6408c16fbf0fa80781, type: 2}
|
roomMaterial: {fileID: 2100000, guid: 39e2ed014eda5d6408c16fbf0fa80781, type: 2}
|
||||||
minPuzzleCount: 1
|
minPuzzleCount: 2
|
||||||
maxPuzzleCount: 1
|
maxPuzzleCount: 5
|
||||||
minRoomSize: {x: 3, y: 3}
|
minRoomSize: {x: 3, y: 3}
|
||||||
playSpace: {x: 4, y: 6}
|
playSpace: {x: 4, y: 6}
|
||||||
genericModule: {fileID: 11400000, guid: cba85a4318ad4750860b84245d9685c4, type: 2}
|
genericModule: {fileID: 11400000, guid: cba85a4318ad4750860b84245d9685c4, type: 2}
|
||||||
|
|||||||
Reference in New Issue
Block a user