Exemplo n.º 1
0
    public void PlayerDeath()
    {
        Debug.Log("Die");
        if (_spawnManager != null)
        {
            Rigidbody2D rigidbody = _spawnManager.currentActivePlayer.GetComponent <Rigidbody2D>();
            if (rigidbody != null)
            {
                rigidbody.constraints = RigidbodyConstraints2D.FreezeAll;
            }

            anim.SetBool("isWalking", false);
            _audioPlay.PlayDeathSound();
            _menuScript.PauseGame();

            _spawnManager.ChangePlayer(_loops);
            if (_loops < 3)
            {
                _loops++;
                Debug.Log(_loops);
            }
        }
    }