internal void End() { _didSceneBegin = false; // we kill Renderers and PostProcessors first since they rely on Entities for (var i = 0; i < _renderers.Length; i++) { _renderers.Buffer[i].Unload(); } for (var i = 0; i < _postProcessors.Length; i++) { _postProcessors.Buffer[i].Unload(); } // now we can remove the Entities and finally the SceneComponents Core.Emitter.RemoveObserver(CoreEvents.GraphicsDeviceReset, OnGraphicsDeviceReset); Entities.RemoveAllEntities(); for (var i = 0; i < _sceneComponents.Length; i++) { _sceneComponents.Buffer[i].OnRemovedFromScene(); } _sceneComponents.Clear(); Camera = null; Content.Dispose(); _sceneRenderTarget.Dispose(); Physics.Clear(); if (_destinationRenderTarget != null) { _destinationRenderTarget.Dispose(); } if (EntityProcessors != null) { EntityProcessors.End(); } Unload(); }
internal void End() { _didSceneBegin = false; // we kill Renderers and PostProcessors first since they rely on Entities // now we can remove the Entities and finally the SceneComponents Entities.RemoveAllEntities(); for (var i = 0; i < _sceneComponents.Length; i++) { _sceneComponents.Buffer[i].OnRemovedFromScene(); } _sceneComponents.Clear(); Physics.Clear(); Unload(); }