Exemplo n.º 1
0
        /// <summary>
        /// Unload contents
        /// </summary>
        public override void UnloadContent()
        {
            if (TarnishTexture != null)
            {
                TarnishTexture.Dispose();
            }

            if (CubeTexture != null)
            {
                CubeTexture.Dispose();
            }

            if (Cube != null)
            {
                Cube.Dispose();
            }

            if (Sphere != null)
            {
                Sphere.Dispose();
            }

            if (Skybox != null)
            {
                Skybox.Dispose();
            }

            if (Reflection != null)
            {
                Reflection.Dispose();
            }
        }
Exemplo n.º 2
0
        public void Dispose()
        {
            chunkThread.Abort();
            chunkThread = null;

            foreach (var entity in loadedEntities)
            {
                DestroyEntity(entity);
            }

            ClearUpEntities();
            loadedEntities.Clear();
            loadedEntities = null;
            player         = null;

            foreach (var loadedChunk in loadedChunks)
            {
                loadedChunk.Dispose();
            }
            loadedChunks.Clear();
            loadedChunks = null;

            chunksToUpdate.Clear();
            chunksToUpdate = null;

            chunksToKeep.Clear();
            chunksToKeep = null;

            newChunks.Clear();
            newChunks = null;

            //DONT MANUALLY DISPOSE ASSETS

            //Chunk.ChunkMaterial?.Dispose();
            //Chunk.ChunkWaterMaterial?.Dispose();

            //loadingScreenTexture.Dispose();
            //loadingScreenTextureDickJoke.Dispose();
            //TexturePack.Dispose();

            Skybox.Dispose();
            World.instance = null;
            GC.Collect();
        }