예제 #1
0
        protected virtual void Die()
        {
            stateMachine.ExitState();
            if (Anim != false)
            {
                Anim.enabled = false;
            }
            spriteAnim !.SetTrigger(Dying);

            var damageableAreas = GetComponentsInChildren <EnemyDamageableArea>();

            foreach (var damageableArea in damageableAreas)
            {
                damageableArea.DisableCollider();
            }

            damagingArea.DisableCollider();

            HideShadows();

            _enemyDeathParticles.PlayParticles();
            _essenceOfPunishmentSpawner.SpawnEssences(BaseParameters.Stats.essenceOfPunishmentAmount);

            SoundsPlayer.Play("Dying");

            onDie?.Invoke();

            if (!BaseParameters.hasBeenSpawned)
            {
                SaveSystem.AddEnemyDead(BaseParameters.id);
            }
        }