TO SQUASH: Lots of UI.
This commit is contained in:
@@ -24,6 +24,8 @@ public class WorldFiller : MonoBehaviour
|
||||
|
||||
private int wallCount = 0;
|
||||
|
||||
private Queue<GameObject> spawnedWalls = new Queue<GameObject>();
|
||||
|
||||
private List<Rect> freeAreas = new List<Rect>();
|
||||
|
||||
private float boardArea;
|
||||
@@ -44,6 +46,21 @@ public class WorldFiller : MonoBehaviour
|
||||
wallCount = 0;
|
||||
}
|
||||
|
||||
public void ClearSpawnedWalls()
|
||||
{
|
||||
while (spawnedWalls.Count > 0)
|
||||
{
|
||||
GameObject wall = spawnedWalls.Dequeue();
|
||||
|
||||
if (wall != null)
|
||||
{
|
||||
Destroy(wall);
|
||||
}
|
||||
}
|
||||
|
||||
spawnedWalls.Clear();
|
||||
}
|
||||
|
||||
public void SetWallPosition(Vector2 position)
|
||||
{
|
||||
if (wallCount >= wallPositions.Length)
|
||||
@@ -63,8 +80,6 @@ public class WorldFiller : MonoBehaviour
|
||||
// If both wall positions are set, spawn a wall.
|
||||
if (wallPositions[0] != null && wallPositions[1] != null)
|
||||
{
|
||||
Debug.Log($"Spawning wall with wall line: ({wallPositions[0]}, {wallPositions[1]})");
|
||||
|
||||
Vector2 wallPointA = wallPositions[0].Value;
|
||||
Vector2 wallPointB = wallPositions[1].Value;
|
||||
|
||||
@@ -176,6 +191,7 @@ public class WorldFiller : MonoBehaviour
|
||||
Rect paddedWallRect = ExpandRectInsideBounds(clampedWallRect, wallPaddingWorldUnits, boardRect);
|
||||
|
||||
ApplyWallTransform(wall.transform, wallRenderer, paddedWallRect);
|
||||
spawnedWalls.Enqueue(wall);
|
||||
var wallBounds = wallRenderer.bounds;
|
||||
|
||||
UpdateFreeAreas(paddedWallRect);
|
||||
@@ -248,7 +264,7 @@ public class WorldFiller : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeFreeAreas()
|
||||
public void InitializeFreeAreas()
|
||||
{
|
||||
gameBoardBounds = gameBoardSpriteRenderer.bounds;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user