This commit is contained in:
Gerard Gascón 2025-04-24 17:29:51 +02:00
commit 3b4c6e0ec6
506 changed files with 434142 additions and 0 deletions

View file

@ -0,0 +1,33 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ExplosionController : MonoBehaviour, IPooledObject{
float currentTime;
[SerializeField, Range(0, 3)] float timeToDisappear = 1f;
BoxCollider col;
void Start(){
col = GetComponent<BoxCollider>();
}
// Start is called before the first frame update
public void OnObjectSpawn(){
currentTime = 0;
if(col != null){
col.enabled = true;
}
}
// Update is called once per frame
void Update(){
currentTime += Time.deltaTime;
if(currentTime >= .05f){
col.enabled = false;
}
if (currentTime >= timeToDisappear){
gameObject.SetActive(false);
}
}
}