public void Kill(BaseNetworkable.DestroyMode mode = 0) { if (this.IsDestroyed) { UnityEngine.Debug.LogWarning(string.Concat("Calling kill - but already IsDestroyed!? ", this)); return; } Interface.CallHook("OnEntityKill", this); base.gameObject.BroadcastOnParentDestroying(); this.DoEntityDestroy(); this.TerminateOnClient(mode); this.TerminateOnServer(); this.EntityDestroy(); }
private void TerminateOnClient(BaseNetworkable.DestroyMode mode) { if (this.net == null || this.net.group == null || !((Network.Server)Net.sv).IsConnected()) { return; } this.LogEntry(BaseMonoBehaviour.LogEntryType.Network, 2, "Term {0}", (object)mode); if (!((Write)((NetworkPeer)Net.sv).write).Start()) { return; } ((Write)((NetworkPeer)Net.sv).write).PacketID((Message.Type) 6); ((Write)((NetworkPeer)Net.sv).write).EntityID((uint)this.net.ID); ((Write)((NetworkPeer)Net.sv).write).UInt8((byte)mode); ((Write)((NetworkPeer)Net.sv).write).Send(new SendInfo((IEnumerable <Connection>)((Group)this.net.group).subscribers)); }
public void Kill(BaseNetworkable.DestroyMode mode = BaseNetworkable.DestroyMode.None) { if (this.IsDestroyed) { Debug.LogWarning((object)("Calling kill - but already IsDestroyed!? " + (object)this)); } else { Interface.CallHook("OnEntityKill", (object)this); ((Component)this).get_gameObject().BroadcastOnParentDestroying(); this.DoEntityDestroy(); this.TerminateOnClient(mode); this.TerminateOnServer(); this.EntityDestroy(); } }
/// <summary> /// Kills JDeployable. /// </summary> /// <param name="mode"></param> /// <param name="remove">Remove JDeployable instance from JDeployableManager so it isn't saved</param> public void Kill(BaseNetworkable.DestroyMode mode = BaseNetworkable.DestroyMode.None, bool remove = true) { if (isBeingDestroyed) { return; } if (MainParent != null && !MainParent.IsDestroyed) { isBeingDestroyed = true; MainParent.Kill(mode); } if (remove) { JDeployableManager.RemoveJDeployable(this.Id); } }
private void TerminateOnClient(BaseNetworkable.DestroyMode mode) { if (this.net == null) { return; } if (this.net.@group == null) { return; } if (!Network.Net.sv.IsConnected()) { return; } base.LogEntry(BaseMonoBehaviour.LogEntryType.Network, 2, "Term {0}", mode); if (Network.Net.sv.write.Start()) { Network.Net.sv.write.PacketID(Message.Type.EntityDestroy); Network.Net.sv.write.EntityID(this.net.ID); Network.Net.sv.write.UInt8((byte)mode); Network.Net.sv.write.Send(new SendInfo([email protected])); } }