using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace EscapeRoomEngine.Engine.Runtime
{
public struct Placement
{
public Vector3Int position;
public Vector2Int size;
public Orientation orientation;
///
/// Create a set with every possible combination of position and orientation given the dimensions.
///
///
/// The size of all placements will be (1, 1).
///
///
public List EveryPlacement
{
get
{
var placements = new List();
for (var zIter = 0; zIter < size.y; zIter++)
{
for (var xIter = 0; xIter < size.x; xIter++)
{
placements.AddRange(OrientationExtensions.EveryOrientation().Select(o => new Placement
{
position = new Vector3Int(xIter, 0, zIter),
size = Vector2Int.one,
orientation = o
}));
}
}
return placements;
}
}
public string PositionAndOrientation() => $"{{({position.x}, {position.z}), {orientation}}}";
public override string ToString() => $"{{{position}, {size}, {orientation}}}";
}
}