using System.Collections; using System.Collections.Generic; using UnityEngine; public class ActionHelper : MonoBehaviour { public float destructionTimer = 0; public bool usingPool = false; float t; private void Awake() { t = 0; } private void Update() { HandleDestruction(); } void HandleDestruction() { if (destructionTimer <= 0) { return; } if (t < destructionTimer) { t += Time.deltaTime; } else { if (usingPool) { ObjectsPool.instance.ReturnItem(gameObject); } else { Destroy(gameObject); } t = 0; } } }