public void Despawn() { if (this.instances == null || this.InstanceData == null) { return; } for (int i = 0; i < this.instances.Length; i++) { if (this.currentlyVisible && i < this.scheduledSpawnIndex && (!this.instances[i] || !this.instances[i].activeSelf) && this.InstanceData != null && this.InstanceData[i].Spawned) { if (this.AllowRegrowth) { this.InstanceData[i].CreationTime = Time.timeSinceLevelLoad; } else { this.InstanceData[i].Destroyed = true; } if (this.Data != null) { this.Data._instancesState[i] = 255; } } if (Application.isPlaying) { if (this.MpSync && BoltNetwork.isServer && this.instances[i]) { BoltNetwork.Detach(this.instances[i]); } GreeblePlugin.Destroy(this.instances[i]); } else { UnityEngine.Object.DestroyImmediate(this.instances[i]); } this.InstanceData[i].Spawned = false; this.instances[i] = null; } this.currentlyVisible = false; }
private void DestroyGreeble(int x, int y, int z) { GreeblePlugin.Destroy(this.greebles[x, y, z].Instance); this.greebles[x, y, z].Instance = null; }