Exemplo n.º 1
0
    void Die()
    {
        StopCoroutine(firingCoroutine);
        playerSpawner.HandleDeath();
        GameObject explosion = Instantiate(
            explosionPrefab,
            transform.position,
            transform.rotation) as GameObject;

        Destroy(explosion, explosionTime);
        AudioSource.PlayClipAtPoint(deathSound, Camera.main.transform.position, 1);
        Destroy(gameObject);
    }