add project files
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using UnityEngine;
|
||||
using OHM.UnityToolkit.Pooling;
|
||||
|
||||
namespace OHM.UnityToolkit
|
||||
{
|
||||
public class DelayedDestroy : MonoBehaviour, PooledObjectListener
|
||||
{
|
||||
public float delay;
|
||||
|
||||
public bool unscaledTime;
|
||||
|
||||
private float _remainingDelay;
|
||||
|
||||
public void OnRelease()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnReset()
|
||||
{
|
||||
_remainingDelay = delay;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_remainingDelay = delay;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
_remainingDelay -= (unscaledTime ? Time.unscaledDeltaTime : Time.deltaTime);
|
||||
if (_remainingDelay <= 0f)
|
||||
{
|
||||
PoolsManager.ReleaseObject(base.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user