requirements foundation
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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
|
||||
{
|
||||
public override HashSet<Vector2Int> PlacementCandidates(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));
|
||||
}
|
||||
for (var z = 0; z < space.rrDimensions.length; z++)
|
||||
{
|
||||
edgePositions.Add(new Vector2Int(0, z));
|
||||
edgePositions.Add(new Vector2Int(space.rrDimensions.width, z));
|
||||
}
|
||||
|
||||
return edgePositions;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user