Esempio n. 1
0
 void Killed()
 {
     if (NetworkClient.Instance != null)
     {
         if (NetworkClient.Instance.IsHost)
         {
             networkID.Destroy();
         }
     }
     else
     {
         Destroy(gameObject);
     }
 }
Esempio n. 2
0
    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);
        }
    }
Esempio n. 3
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();
        }
    }
Esempio n. 4
0
 void NetworkDestroy()
 {
     networkID.Destroy();
 }