DestroyPlayerObjects() public method

Destroys all Instantiates and RPCs locally and (if not localOnly) sends EvDestroy(player) and clears related events in the server buffer.
public DestroyPlayerObjects ( int playerId, bool localOnly ) : void
playerId int
localOnly bool
return void
Beispiel #1
0
    /// <summary>
    /// Destroy all GameObjects/PhotonViews of this player.
    /// </summary>
    /// <param name="player"></param>
    public static void DestroyPlayerObjects(PhotonPlayer player)
    {
        if (!VerifyCanUseNetwork())
        {
            return;
        }

        networkingPeer.DestroyPlayerObjects(player);
    }
Beispiel #2
0
 public static void DestroyPlayerObjects(int targetPlayerId)
 {
     if (VerifyCanUseNetwork())
     {
         //if (!player.isMasterClient && (targetPlayerId != player.ID)) {
         //    Debug.LogError("DestroyPlayerObjects() failed, cause players can only destroy their own GameObjects. A Master Client can destroy anyone's. This is master: " + isMasterClient);
         //} else {
         networkingPeer.DestroyPlayerObjects(targetPlayerId, false);
         //}
     }
 }
Beispiel #3
0
 public static void DestroyPlayerObjects(int targetPlayerId)
 {
     if (VerifyCanUseNetwork())
     {
         if (player.isMasterClient || targetPlayerId == player.Id)
         {
             networkingPeer.DestroyPlayerObjects(targetPlayerId, localOnly: false);
         }
         else
         {
             Debug.LogError("DestroyPlayerObjects() failed, cause players can only destroy their own GameObjects. A Master Client can destroy anyone's. This is master: " + isMasterClient);
         }
     }
 }
Beispiel #4
0
 public static void DestroyPlayerObjects(int targetPlayerId, bool local = false)
 {
     if (VerifyCanUseNetwork() && (targetPlayerId != player.ID))
     {
         if (player.isMasterClient || (targetPlayerId == player.ID))
         {
             if (local)
             {
                 networkingPeer.SendDestroyOfAllTo(targetPlayerId);
             }
             networkingPeer.DestroyPlayerObjects(targetPlayerId, false);
         }
         else
         {
             Debug.LogError("DestroyPlayerObjects() failed, cause players can only destroy their own GameObjects. A Master Client can destroy anyone's. This is master: " + isMasterClient);
         }
     }
 }