void Killed() { if (NetworkClient.Instance != null) { if (NetworkClient.Instance.IsHost) { networkID.Destroy(); } } else { Destroy(gameObject); } }
void Die() { if (Explosion != null) { Instantiate(Explosion, transform.position, Quaternion.identity); } bossState = BossState.Idle; boxCollider2D.enabled = false; if (NetworkClient.Instance == null || NetworkClient.Instance.IsHost) { networkID.Destroy(2.5f); } }
public void RemoteKilled() { Instantiate(explode, transform.position, Quaternion.identity); // Only the source player GameObject should be respawned. // SceneSpawner will handle the remote duplicate creation for the respawned player. if (networkId.IsMine) { GameSceneManager gameSceneManager = FindObjectOfType <GameSceneManager>(); // Call the DelayedRespawnPlayer() method you just added to the GameSceneManager.cs script. gameSceneManager.DelayedRespawnPlayer(); // NetworkID will find its SceneSpawner and remove its spawn records. // The Networked GameObject will be destroyed across the network. networkId.Destroy(); } }
void NetworkDestroy() { networkID.Destroy(); }