private void Death(bool triggerDeathEvent, bool tryAddenergy) { StopCoroutine("ChangingSoulWalkingDirection"); alarm = false; _audioSource.Play(); _currentSpeed = 0f; isDead = true; collider.enabled = false; _rigidbody.isKinematic = true; _deathAnimator.SetBool("Scary", false); navMeshAgent.enabled = false; triggers.SetActive(false); if (triggerDeathEvent) { SoulDeath?.Invoke(this, tryAddenergy); } Destroy(gameObject, 2f); }
public void DeathByAnimation() { SoulDeath?.Invoke(this, true); }