2026-08-25 22:24:07 -04:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public abstract class Spawner : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
protected bool isSpawning = true;
|
|
|
|
|
|
|
|
|
|
public void StopSpawning()
|
|
|
|
|
{
|
|
|
|
|
isSpawning = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void StartSpawning()
|
|
|
|
|
{
|
|
|
|
|
isSpawning = true;
|
|
|
|
|
}
|
2026-08-27 17:14:18 -04:00
|
|
|
|
|
|
|
|
protected Vector2 GetRandomSpawnPosition(Bounds bounds)
|
|
|
|
|
{
|
|
|
|
|
var spawnPosition = new Vector2(
|
|
|
|
|
Random.Range(
|
|
|
|
|
bounds.min.x + bounds.extents.x,
|
|
|
|
|
bounds.max.x - bounds.extents.x
|
|
|
|
|
),
|
|
|
|
|
Random.Range(
|
|
|
|
|
bounds.min.y + bounds.extents.y,
|
|
|
|
|
bounds.max.y - bounds.extents.y
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return spawnPosition;
|
|
|
|
|
}
|
2026-08-25 22:24:07 -04:00
|
|
|
}
|