Beispiel #1
0
    void Die()
    {
        _healthBar.Destroy();

        Patrol patrol = GetComponent <Patrol>();

        if (patrol != null)
        {
            patrol.Stop();
        }
        Pathfind pathfind = GetComponent <Pathfind>();

        if (pathfind != null)
        {
            pathfind.Stop();
        }

        _hitbox.enabled    = false;
        _rb.bodyType       = RigidbodyType2D.Kinematic;
        transform.rotation = Quaternion.Euler(0, 0, 0);
        _animator.SetBool("isDead", true);
        Destroy(gameObject, _deathAnimationDuration);
    }