예제 #1
0
        public void Dispose()
        {
            Disposing = true;

            if (OrderGenerator != null)
            {
                OrderGenerator.Deactivate();
            }

            frameEndActions.Clear();

            Game.Sound.StopAudio();
            Game.Sound.StopVideo();
            if (IsLoadingGameSave)
            {
                Game.Sound.DisableAllSounds = false;
            }

            ModelCache.Dispose();

            // Dispose newer actors first, and the world actor last
            foreach (var a in actors.Values.Reverse())
            {
                a.Dispose();
            }

            // Actor disposals are done in a FrameEndTask
            while (frameEndActions.Count != 0)
            {
                frameEndActions.Dequeue()(this);
            }

            Game.FinishBenchmark();
        }