Пример #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);
            }
        }
Пример #2
0
        /// <summary>
        /// Load any content (textures, fonts, etc) required for this state.
        /// </summary>
        public override void LoadContent()
        {
            visibleTiles = new DrawableTile[map.Width * map.Height];
            FillTiles();

            miniMap = new Minimap(Players, localPlayer);
            miniMap.SetMap(map, this);

            Scene.CreateCamera(
                new Vector3(localPlayer.Position.X, localPlayer.Position.Y, GamePlayState.DefaultCameraDistance),
                new Vector3(localPlayer.Position.X, localPlayer.Position.Y, 0),
                Matrix.CreatePerspectiveFieldOfView(
                    MathHelper.PiOver4,
                    (float)GraphicOptions.graphics.GraphicsDevice.Viewport.Width /
                        (float)GraphicOptions.graphics.GraphicsDevice.Viewport.Height,
                    10f,
                    5000f),
                OverheadCamera);
            Scene.SwitchCamera(OverheadCamera);
            Scene.AccessCamera(OverheadCamera).Follow(localPlayer);

            Scene.CreateCamera(
                localPlayer.Position - localPlayer.Front * 1000 + localPlayer.Up * 400,
                localPlayer.Position + new Vector3(0, 0, 100),
                renderer.ActiveScene.AccessCamera(OverheadCamera).Projection,
                ChaseCamera);
            Scene.AccessCamera(ChaseCamera).CameraUp = Vector3.UnitZ;

            timeLeft = ServiceManager.Theater.TimeLeftSeconds;
            ServiceManager.Game.Renderer.ActiveScene.SwitchCamera(ChaseCamera);
            ServiceManager.Game.Renderer.ActiveScene.CurrentCamera.LockTo(localPlayer, new Vector3(-500, 0, 200), new Vector3(0,0,75));
            ServiceManager.Game.Renderer.ActiveScene.LockCameras();
            callback.Ready = true;

            ServiceManager.Theater.Ready();
        }