private void Cleanup() { if (this.def.subSounds.Count > 0) { Find.SoundRoot.sustainerManager.DeregisterSustainer(this); for (int i = 0; i < this.subSustainers.Count; i++) { this.subSustainers[i].Cleanup(); } } if (this.def.sustainStopSound != null) { if (this.worldRootObject != null) { Map map = this.info.Maker.Map; if (map != null) { SoundInfo soundInfo = SoundInfo.InMap(new TargetInfo(this.worldRootObject.transform.position.ToIntVec3(), map, false), MaintenanceType.None); this.def.sustainStopSound.PlayOneShot(soundInfo); } } else { this.def.sustainStopSound.PlayOneShot(SoundInfo.OnCamera(MaintenanceType.None)); } } if (this.worldRootObject != null) { UnityEngine.Object.Destroy(this.worldRootObject); } DebugSoundEventsLog.Notify_SustainerEnded(this, this.info); }
private void Cleanup() { if (def.subSounds.Count > 0) { Find.SoundRoot.sustainerManager.DeregisterSustainer(this); for (int i = 0; i < subSustainers.Count; i++) { subSustainers[i].Cleanup(); } } if (def.sustainStopSound != null) { if (worldRootObject != null) { Map map = info.Maker.Map; if (map != null) { SoundInfo soundInfo = SoundInfo.InMap(new TargetInfo(worldRootObject.transform.position.ToIntVec3(), map)); def.sustainStopSound.PlayOneShot(soundInfo); } } else { def.sustainStopSound.PlayOneShot(SoundInfo.OnCamera()); } } if (worldRootObject != null) { Object.Destroy(worldRootObject); } DebugSoundEventsLog.Notify_SustainerEnded(this, info); }