示例#1
0
    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();
        }
    }