add explodable script

This commit is contained in:
2026-07-15 21:23:59 -05:00
parent 2715ba7a86
commit 16342f1ff4
8 changed files with 5368 additions and 2 deletions
+4
View File
@@ -4,6 +4,7 @@ public class Tnt : MonoBehaviour
{
public Light explodeLight;
public ParticleSystem explodeParticle;
public Explosion explosion;
public float fuseTime;
public float explosionLengthTime;
@@ -17,6 +18,8 @@ void Update()
if (!exploded && timer > fuseTime)
{
exploded = true;
explosion.gameObject.SetActive(true);
explosion.transform.parent = null;
explodeLight.gameObject.SetActive(true);
explodeLight.transform.parent = null;
explodeParticle.gameObject.SetActive(true);
@@ -26,6 +29,7 @@ void Update()
Destroy(explodeLight.gameObject, explosionLengthTime);
Destroy(explodeParticle.gameObject, explosionLengthTime);
Destroy(explosion.gameObject, 0.1f);
Destroy(gameObject);
}