public override void OnUnregister() { // Parent OnUnregister. base.OnUnregister(); // since we are being removed we need to shutdown completely. StopEffect(false); ProcessList.Instance.RemoveObject(this); // Sanity! Debug.Assert(!EffectPlaying, "Effect has been recycled but is still playing!"); // clear out variables in case we are recycled and used again. Normally we would only need to do this in Reset, but right now // the engine doesn't call Reset on us, so we need to do it here. Once the engine is calling Reset we can remove this code, but // it is still not a bad idea to clear things out here. _effectAge = 0.0f; _waitingForParticlesClear = false; _effectPlaying = false; //_peakParticleAllocations = 0; // its ok to not reset this. _currentParticleAllocations = 0; _effectData.OnEmitterListChanged -= _OnEmitterListChanged; this.OnEffectStart = null; this.OnEffectStop = null; //_effectData = null; }
public override void Dispose() { _IsDisposed = true; if (!_vertexBuffer.IsNull) { _vertexBuffer.Instance.Dispose(); _vertexBuffer.Invalidate(); } if (!_indexBuffer.IsNull) { _indexBuffer.Instance.Dispose(); _indexBuffer.Invalidate(); } if (_effectData != null) { //_effectData.ClearEmitterData(); _effectData.OnEmitterListChanged -= _OnEmitterListChanged; } _effectData = null; if (_emitterList != null) { for (int i = _emitterList.Count - 1; i >= 0; i--) _emitterList[i] = null; _emitterList = null; } this.OnEffectStart = null; this.OnEffectStop = null; this.OnRegistered = null; base.Dispose(); }