24 lines
821 B
C#
24 lines
821 B
C#
using System.Collections.Generic;
|
|
using EscapeRoomEngine.Engine.Runtime.Modules;
|
|
using UnityEngine;
|
|
|
|
namespace EscapeRoomEngine.Engine.Runtime.Requirements
|
|
{
|
|
[CreateAssetMenu(menuName = "Requirements/Place Along Space Edges")]
|
|
public class PlaceAlongSpaceEdges : PlacementRequirement
|
|
{
|
|
protected override List<Placement> FilterCandidates(List<Placement> candidates, Module module, Space space)
|
|
{
|
|
var right = space.rrPlacement.size.x - 1;
|
|
var top = space.rrPlacement.size.y - 1;
|
|
|
|
candidates.RemoveAll(candidate =>
|
|
{
|
|
var position = candidate.position;
|
|
return position.x > 0 && position.x < right && position.z > 0 && position.z < top;
|
|
});
|
|
|
|
return candidates;
|
|
}
|
|
}
|
|
} |