Exemple #1
0
        /// <summary>
        /// Unload any content (textures, fonts, etc) used by this state. Called when the state is removed.
        /// </summary>
        public override void UnloadContent()
        {
            /*try
             * {
             *  ServiceManager.Game.GraphicsDevice.Reset();
             *  ServiceManager.Game.GraphicsDevice.VertexDeclaration = null;
             *  ServiceManager.Game.GraphicsDevice.Vertices[0].SetSource(null, 0, 0);
             * }
             * catch (Exception ex)
             * {
             *  // If the graphics device was disposed already, it throws an exception.
             *  Console.Error.WriteLine(ex);
             * }*/

            if (mouseCursor != null)
            {
                mouseCursor.DisableCustomCursor();
                mouseCursor = null;
            }
            EnvironmentEffects = null;
            Bases        = null;
            buffbar      = null;
            cd           = null;
            hud          = null;
            renderer     = null;
            fps          = null;
            map          = null;
            visibleTiles = null;
            Scores       = null;
            Players      = null;
            Projectiles  = null;
            Chat         = null;
            buffer       = null;
            miniMap.Dispose();
            miniMap = null;

            if (OnGameFinished != null)
            {
                EventArgs args = new EventArgs();
                OnGameFinished.Invoke(this, args);
            }
        }