Пример #1
0
    public override void DeathEffects()
    {
        base.DeathEffects();
        gameObject.tag = Tags.enemyDead;
        foreach (GameObject objToDeactivate in objectsToDeactivateOnDeath)
        {
            objToDeactivate.SetActive(false);
        }
        enemiesCounter.enemyKilled();

        if (destroyOnDeath)
        {
            Destroy(gameObject);
        }

        if (prisonerToSave != null)
        {
            if (getUnitWhoKilledThis() != null)
            {
                if (getUnitWhoKilledThis().GetComponent <PrisonersSaved>() != null)
                {
                    prisonerToSave.SavePrisoner(getUnitWhoKilledThis());
                }
                else
                {
                    FirstAliveCharacterSavePrisoner();
                }
            }
            else
            {
                FirstAliveCharacterSavePrisoner();
            }
        }
    }