コード例 #1
0
    private void Dying()
    {
        GameObject bang = Instantiate(_explosion, transform.position, Quaternion.identity);

        Destroy(bang, 1f);
        AudioSource.PlayClipAtPoint(_deathSFX, Camera.main.transform.position, _deathSoundVolume);

        _livesManager.numOfLives--;
        _livesManager.DisplayLives(_livesManager.numOfLives);
        if (_livesManager.numOfLives == 0)
        {
            Destroy(gameObject);
            _sceneLoader.LoadGameOverScene();
        }
        else
        {
            StartCoroutine(Respawning());
        }
    }