add explodable script
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user