Example #1
0
    private void Die()
    {
        GameSession gs = FindObjectOfType <GameSession>();

        gs.AddScore(scoreValue);
        Destroy(gameObject);
        GameObject explosion = Instantiate(deathVFX, transform.position, transform.rotation);

        Destroy(explosion, durationOfExplosion);
        AudioSource.PlayClipAtPoint(deathSound, Camera.main.transform.position, deathVolume);
        gs.AddDeadEnemy();
    }