Adding trick respawn logic
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class TrickSpawnKeeper : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Spawner spawner;
|
||||
[SerializeField] private float checkInterval = 1f;
|
||||
private float nextCheckTime;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Time.time < nextCheckTime)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
nextCheckTime = Time.time + checkInterval;
|
||||
if (spawner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (TrickController.ActiveCount == 0)
|
||||
{
|
||||
spawner.SpawnNow();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user