Example #1
0
    private void Die()
    {
        TriggerDeathVFX();

        if (isDefender)
        {
            defenderSpawner.RemoveKey(gameObject.transform.position);
        }

        if (deathAudio)
        {
            foreach (SpriteRenderer spriteRenderer in spriteRenderers)
            {
                spriteRenderer.enabled = false;
            }
            Destroy(gameObject, deathAudio.length);
        }
        else
        {
            Destroy(gameObject);
        }
    }