using System.Collections; using System.Collections.Generic; using UnityEngine; public class AgenteSupervisor : MonoBehaviour { public Vector3 muroPosition = new Vector3(0, 0, 5); // Posición del muro public int width = 5; public int height = 3; private Queue pendingPositions = new Queue(); private HashSet assignedPositions = new HashSet(); void Start() { GenerateBlockPositions(); } void GenerateBlockPositions() { for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { Vector3 pos = muroPosition + new Vector3(x, y, 0); pendingPositions.Enqueue(pos); } } } public Vector3? AssignNextBlockPosition() { while (pendingPositions.Count > 0) { Vector3 next = pendingPositions.Dequeue(); if (!assignedPositions.Contains(next)) { assignedPositions.Add(next); return next; } } return null; } public void ReleasePosition(Vector3 pos) { assignedPositions.Remove(pos); pendingPositions.Enqueue(pos); } }