Beispiel #1
0
 private void UnloadGame()
 {
     this.camera         = (Camera)null;
     this.player         = (Player)null;
     this.lord           = (AIOverLord)null;
     this.map1           = (Map)null;
     this.pauseScreen    = (Pause)null;
     this.gameGui        = (GameGUI)null;
     this.dask_Backgourd = (Texture2D)null;
     this.Cloud1         = (Scroll)null;
     this.Cloud2         = (Scroll)null;
 }
Beispiel #2
0
        protected override void LoadContent()
        {
            this.spriteBatch = new SpriteBatch(this.GraphicsDevice);
            switch (this.gameStateIntent)
            {
            case GameState.Menu:
                this.menu = new Menu();
                this.menu.Instil(this.Content, this.GraphicsDevice);
                this.menu.start.click  += new Button.ClickHandler(this.SwitchToGame);
                this.menu.editor.click += new Button.ClickHandler(this.SwitchToEditor);
                break;

            case GameState.InGame:
                this.camera = new Camera(this.GraphicsDevice.Viewport);
                this.player = new Player();
                this.lord   = new AIOverLord();
                this.LoadMap(this.mapPath);
                this.map1.Instil(this, this.Content);
                this.player.Instil(this.Content, this.map1);
                this.camera.Instil(new Vector2(this.player.Location.X - (float)(this.GraphicsDevice.Viewport.Width / 2), this.player.Location.Y));
                this.lord.Instil(this.map1, this.Content, this.player);
                this.gameGui        = new GameGUI(this.Content, this.player, this.map1);
                this.dask_Backgourd = this.Content.Load <Texture2D>("Graphics\\Dask_Backgourd");
                this.Cloud1         = new Scroll(new Texture2D[3]
                {
                    this.Content.Load <Texture2D>("Graphics\\Cloud\\Cloud_Layer1_001"),
                    this.Content.Load <Texture2D>("Graphics\\Cloud\\Cloud_Layer1_002"),
                    this.Content.Load <Texture2D>("Graphics\\Cloud\\Cloud_Layer1_003")
                }, 4f, this.map1.xMax, this.GraphicsDevice.Viewport.Width);
                this.Cloud2 = new Scroll(new Texture2D[3]
                {
                    this.Content.Load <Texture2D>("Graphics\\Cloud\\Cloud_Layer2_001"),
                    this.Content.Load <Texture2D>("Graphics\\Cloud\\Cloud_Layer2_002"),
                    this.Content.Load <Texture2D>("Graphics\\Cloud\\Cloud_Layer2_003")
                }, 3f, this.map1.xMax, this.GraphicsDevice.Viewport.Width);
                this.pauseScreen               = new Pause(this.Content, this.GraphicsDevice, this.GraphicsDevice.Viewport);
                this.pauseScreen.menu.click   += new Button.ClickHandler(this.SwitchToMenuGame);
                this.pauseScreen.resume.click += new Button.ClickHandler(this.ResumeGame);
                break;

            case GameState.Editor:
                this.GraphicsDevice.Viewport = new Viewport(0, 0, this.graphics.PreferredBackBufferWidth, this.graphics.PreferredBackBufferHeight);
                this.cameraMap = new CameraMap(this.GraphicsDevice.Viewport, this.currentM);
                this.gui       = new Gui();
                this.map       = new EditMap(this, this.Content, this.cameraMap);
                this.gui.Instil(this.Content, this.GraphicsDevice, this.map, this);
                this.pauseScreen               = new Pause(this.Content, this.GraphicsDevice, this.GraphicsDevice.Viewport);
                this.pauseScreen.menu.click   += new Button.ClickHandler(this.SwitchToMenuEditor);
                this.pauseScreen.resume.click += new Button.ClickHandler(this.ResumeEditor);
                break;
            }
        }