28 lines
1003 B
C#
28 lines
1003 B
C#
using System.Collections.Generic;
|
|
using Escape_Room_Engine.Engine.Scripts.Modules;
|
|
using UnityEngine;
|
|
|
|
namespace Escape_Room_Engine.Engine.Scripts.Requirements
|
|
{
|
|
[CreateAssetMenu(menuName = "Requirements/Place Along Space Edges")]
|
|
public class PlaceAlongSpaceEdges : PlacementRequirement
|
|
{
|
|
protected override IEnumerable<Vector2Int> GenerateCandidates(Module module, Space space)
|
|
{
|
|
var edgePositions = new HashSet<Vector2Int>();
|
|
|
|
for (var x = 0; x < space.rrDimensions.width; x++)
|
|
{
|
|
edgePositions.Add(new Vector2Int(x, 0));
|
|
edgePositions.Add(new Vector2Int(x, space.rrDimensions.length - 1));
|
|
}
|
|
for (var z = 0; z < space.rrDimensions.length; z++)
|
|
{
|
|
edgePositions.Add(new Vector2Int(0, z));
|
|
edgePositions.Add(new Vector2Int(space.rrDimensions.width - 1, z));
|
|
}
|
|
|
|
return edgePositions;
|
|
}
|
|
}
|
|
} |