public void PlayerRespawnPod(PlayerInput input)
    {
        if (++_playerCount > 1)
        {
            _trainData.PlayerCount++;
        }
        PlayerV1 player = input.GetComponent <PlayerV1>();

        player.transform.SetParent(_trainData.TrainTransform);
        player.transform.position = _playerSpawnPod.transform.position;
        player.RespawnPoint       = _playerSpawnPod.transform.position;

        if (!_respawnPod)
        {
            _respawnPod = _playerSpawnPod.GetComponent <RespawnPod>();
        }

        _respawnPod.AnimationRespawnPod();
    }
예제 #2
0
    private IEnumerator Respawn()
    {
        _isRespawn = true;
        SpriteRenderer localSprite = GetComponent <SpriteRenderer>();

        localSprite.enabled = false;
        _healthBar.SetBarVisible(false);
        yield return(new WaitForSeconds(5.0f));

        RespawnPod respawnPod = FindObjectOfType <RespawnPod>();

        respawnPod.AnimationRespawnPod();

        localSprite.enabled = true;
        _healthBar.SetBarVisible(true);
        transform.position = RespawnPoint;
        _healthSystem.RestoreHealth(_playerData.MaxHealth);
        _isRespawn = false;
        StopCoroutine(_coroutineRegen);
        _coroutineRegen = null;
    }