private void CleanUp() { if (BoltNetwork.isRunning && BoltNetwork.isServer) { BoltEntity componentInParent = base.transform.GetComponentInParent <BoltEntity>(); if (componentInParent && componentInParent.isAttached && componentInParent.IsOwner()) { UnityEngine.Object.Destroy(componentInParent.gameObject); } } else { UnityEngine.Object.Destroy(this.parentGo); } }
private void OnDisable() { if (BoltNetwork.isRunning) { BoltEntity component = base.GetComponent <BoltEntity>(); if (component && component.isAttached && !component.IsOwner()) { return; } } if (Scene.SceneTracker && Scene.SceneTracker.spawnedLogs.Contains(base.transform)) { Scene.SceneTracker.spawnedLogs.Remove(base.transform); } }
private void OnEnable() { if (BoltNetwork.isRunning) { BoltEntity component = base.GetComponent <BoltEntity>(); if (component && component.isAttached && !component.IsOwner()) { base.enabled = false; return; } } if (Scene.SceneTracker && !Scene.SceneTracker.spawnedLogs.Contains(base.transform)) { Scene.SceneTracker.spawnedLogs.Add(base.transform); } this.age = 0f; }
private void destroyMe() { if (BoltNetwork.isRunning) { BoltEntity componentInParent = base.GetComponentInParent <BoltEntity>(); if (componentInParent && componentInParent.isAttached && !componentInParent.IsOwner()) { return; } } if (this.destroyDistance > 0f) { if ((LocalPlayer.Transform.position - base.transform.position).sqrMagnitude > this.destroyDistance * this.destroyDistance && base.gameObject) { UnityEngine.Object.Destroy(base.gameObject); } } else if (base.gameObject) { UnityEngine.Object.Destroy(base.gameObject); } }