예제 #1
0
        internal IEnumerator ServerPlayerRespawn(bool skipRespawnTime = false)
        {
            if (!skipRespawnTime)
            {
                yield return(new WaitForSeconds(GameManager.GetActiveScene().respawnTime));
            }

            characterController.enabled   = true;
            playerMovementManager.enabled = true;

            Health = MaxHealth;

            RpcClientRespawn();

            //Add stock weapons
            weaponManager.AddStockWeapons();

            //Set position to spawn
            Transform  spawnPoint = NetworkManager.singleton.GetStartPosition();
            Quaternion rotation   = spawnPoint.rotation;

            playerMovementManager.SetCharacterPosition(spawnPoint.position, rotation.x, rotation.y, true);

            IsDead       = false;
            IsInvincible = true;
            yield return(new WaitForSeconds(invincibilityLastTime));

            IsInvincible = false;
        }