Quantcast
Viewing latest article 17
Browse Latest Browse All 115

multiplayer die and respawn

i am trying to make a multiplayer team deathmatch game but i have a problem. when player other then host died the the player still can use the playercontrol and player shoot that i disable . but it still respawn with full hp except it spawn in the same spot as it died private void Die() { isDead = true; for (int i = 0; i < disableOnDeath.Length; i++) { disableOnDeath[i].enabled = false; } Collider _col = GetComponent(); if (_col != null) _col.enabled = false; Debug.Log(transform.name + " is DEAD!"); GameObject _GraphicInstance = (GameObject)Instantiate(DeathEffect, transform.position, Quaternion.identity); Destroy(_GraphicInstance, 3f); StartCoroutine(Respawn()); score.AddTeamScore(1); } private IEnumerator Respawn() { yield return new WaitForSeconds(GameManager.instance.matchSettings.respawnTime); SetDefaults(); Transform _spawnPoint = NetworkManager.singleton.GetStartPosition(); transform.position = _spawnPoint.position; transform.rotation = _spawnPoint.rotation; Debug.Log(transform.name + " respawned."); }

Viewing latest article 17
Browse Latest Browse All 115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>