Exemple #1
0
    IEnumerator DieCoroutine()
    {
        ExplosionSFXManager.Instance.PlayShotSFX();
        PlayerHUDManager.Instance.SetPlayerDeath(playerNumber);
        _movementController.StopPhysics();
        isAlive = false;
        MainCamera.Instance.Shake(0.25f, 0.25f);
        lifes--;
        currentLifeTime = totalLifeTime;
        _currentWeapon.SetActive(false);
        _graphics.enabled = false;

        _deathParticle.Emit(25);

        if (lifes == 0)
        {
            yield break;
        }
        yield return(new WaitForSeconds(_deathParticle.main.startLifetime.constant));

        PlayerManager.Instance.SetSpawnPosition(this.transform);
        isAlive           = true;
        _graphics.enabled = true;
        _currentWeapon.SetActive(true);
        _movementController.StartPhysics();
    }