internal static void HideForConnection(NetworkIdentity uv, NetworkConnection conn) { ObjectDestroyMessage msg = new ObjectDestroyMessage { netId = uv.netId }; conn.Send(13, msg); }
private void DestroyObject(NetworkIdentity uv) { if (LogFilter.logDebug) Debug.Log((object) ("DestroyObject instance:" + (object) uv.netId)); if (NetworkServer.objects.ContainsKey(uv.netId)) NetworkServer.objects.Remove(uv.netId); NetworkDetailStats.IncrementStat(NetworkDetailStats.NetworkDirection.Outgoing, (short) 1, uv.assetId.ToString(), 1); ObjectDestroyMessage objectDestroyMessage = new ObjectDestroyMessage(); objectDestroyMessage.netId = uv.netId; NetworkServer.SendToObservers(uv.gameObject, (short) 1, (MessageBase) objectDestroyMessage); uv.ClearObservers(); if (NetworkClient.active && NetworkServer.s_LocalClientActive) { uv.OnNetworkDestroy(); ClientScene.SetLocalObject(objectDestroyMessage.netId, (GameObject) null); } UnityEngine.Object.Destroy((UnityEngine.Object) uv.gameObject); uv.SetNoServer(); }
private static void DestroyObject(NetworkIdentity uv, bool destroyServerObject) { if (LogFilter.logDebug) { Debug.Log("DestroyObject instance:" + uv.netId); } if (objects.ContainsKey(uv.netId)) { objects.Remove(uv.netId); } if (uv.clientAuthorityOwner != null) { uv.clientAuthorityOwner.RemoveOwnedObject(uv); } NetworkDetailStats.IncrementStat(NetworkDetailStats.NetworkDirection.Outgoing, 1, uv.assetId.ToString(), 1); ObjectDestroyMessage msg = new ObjectDestroyMessage { netId = uv.netId }; SendToObservers(uv.gameObject, 1, msg); uv.ClearObservers(); if (NetworkClient.active && instance.m_LocalClientActive) { uv.OnNetworkDestroy(); ClientScene.SetLocalObject(msg.netId, null); } if (destroyServerObject) { UnityEngine.Object.Destroy(uv.gameObject); } uv.Reset(); }