move puzzle implementations out of engine
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
using EscapeRoomEngine.Engine.Runtime.Modules;
|
||||
using UnityEngine;
|
||||
|
||||
namespace EscapeRoomEngine.Engine.Runtime.Requirements.Placement
|
||||
{
|
||||
/// <summary>
|
||||
/// This requirement guarantees that the back side of the module is placed at the edge of the space.
|
||||
/// </summary>
|
||||
[CreateAssetMenu(menuName = "Requirements/Place Along Space Edges")]
|
||||
public class PlaceAlongSpaceEdges : PlacementRequirement
|
||||
{
|
||||
protected override List<Utilities.Placement> FilterCandidates(List<Utilities.Placement> candidates, Module module, Space space)
|
||||
{
|
||||
var sizeMinusOne = space.rrPlacement.size - Vector2Int.one;
|
||||
|
||||
candidates.RemoveAll(candidate =>
|
||||
{
|
||||
var (left, right) = candidate.BackCorners;
|
||||
return !(left.x == 0 && right.x == 0 ||
|
||||
left.z == 0 && right.z == 0 ||
|
||||
left.x == sizeMinusOne.x && right.x == sizeMinusOne.x ||
|
||||
left.z == sizeMinusOne.y && right.z == sizeMinusOne.y);
|
||||
});
|
||||
|
||||
return candidates;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user