/// <summary> /// Loads graphics content for this screen. The background texture is quite /// big, so we use our own local ContentManager to load it. This allows us /// to unload before going from the menus into the game itself, wheras if we /// used the shared ContentManager provided by the Game class, the content /// would remain loaded forever. /// </summary> public override void LoadContent() { if (content == null) content = new ContentManager(ScreenManager.Game.Services, "GravWalker.Content"); texBG = content.Load<Texture2D>("blank-white"); parallaxManager = new ParallaxManager(ScreenManager.GraphicsDevice.Viewport); }
/// <summary> /// Load graphics content for the game. /// </summary> public override void LoadContent() { if (content == null) content = new ContentManager(ScreenManager.Game.Services, "GravWalker.Content"); //+ (int)(ScreenManager.GraphicsDevice.Viewport.Width/4) //gameRenderTarget = new RenderTarget2D(ScreenManager.GraphicsDevice, ScreenManager.GraphicsDevice.Viewport.Width + (int)(ScreenManager.GraphicsDevice.Viewport.Width / 1.2), ScreenManager.GraphicsDevice.Viewport.Height + (int)(ScreenManager.GraphicsDevice.Viewport.Width / 1.2)); AudioController.LoadContent(content); gameFont = content.Load<SpriteFont>("menufont"); gameMap = content.Load<Map>("maps/testmap2"); GameManager.Map = gameMap; gameHero = new Hero(); gameHero.Initialize(); gameHero.LoadContent(content); GameManager.Hero = gameHero; spawnPos = gameHero.Position; gameSpawnerController = new SpawnerController(gameMap); gameEnemyController = new EnemyController(); gameEnemyController.LoadContent(content, gameSpawnerController.RequiredTypes); gameCamera = new Camera(ScreenManager.GraphicsDevice.Viewport, gameMap); gameCamera.ClampRect = new Rectangle(0, 5 * gameMap.TileHeight, gameMap.Width * gameMap.TileWidth, gameMap.Height * gameMap.TileHeight); //gameCamera.Position = gameHero.Position - (new Vector2(ScreenManager.GraphicsDevice.Viewport.Width, ScreenManager.GraphicsDevice.Viewport.Height) / 2); gameCamera.Position = gameHero.Position; gameCamera.Target = gameCamera.Position; gameCamera.Update(ScreenManager.GraphicsDevice.Viewport.Bounds); GameManager.Camera = gameCamera; gameProjectileManager = new ProjectileManager(); gameProjectileManager.Initialize(); gameProjectileManager.LoadContent(content); GameManager.ProjectileManager = gameProjectileManager; gameParticleController = new ParticleController(); gameParticleController.LoadContent(content); GameManager.ParticleController = gameParticleController; gameWaterController = new WaterController(ScreenManager.GraphicsDevice, gameMap); GameManager.WaterController = gameWaterController; gameGravPadController = new GravPadController(gameMap); GameManager.GravPadController = gameGravPadController; gameHUD = new HUD(ScreenManager.GraphicsDevice.Viewport); gameHUD.Alpha = 0f; gameHUD.LoadContent(content); parallaxManager = new ParallaxManager(ScreenManager.GraphicsDevice.Viewport); parallaxManager.Layers.Add(new ParallaxLayer(content.Load<Texture2D>("bg/bg1"), new Vector2(0, 0), 0.4f, false)); gameHero.Position.Y = spawnPos.Y - startingTransition; GameManager.CurrentScene = 0; GameManager.SceneTime = 0; ScreenManager.Game.ResetElapsedTime(); }