Explosion FX

Hay there I made it with defrant way
would like to know if it follow the good practice or not?

here is the code :

public class CollisionHandler : MonoBehaviour
{
public float timeDelay = .5f;
public GameObject masterTimeline;
public ParticleSystem explosion;

private void OnTriggerEnter(Collider other)
{
    Chashing();
}

void Chashing()
{
    gameObject.SetActive(false);
    masterTimeline.SetActive(false);
    Instantiate(explosion, transform.position, transform.rotation);
    Invoke(nameof(ReLoadLevel), timeDelay);
}

void ReLoadLevel()
{
   
    gameObject.GetComponent<Playercontrols>().enabled = false;
    SceneManager.LoadScene(0);
}

}
and screenchot for the editor :

2 Likes

Boom awesome job!

1 Like

Thanks :blush::blush:

1 Like

Haha you’re welcome :innocent:

1 Like