/// <summary> /// Load graphics content for the game. /// </summary> public override void LoadContent() { if (content == null) content = new ContentManager(ScreenManager.Game.Services, "Content"); AudioController.LoadContent(content); //gameFont = content.Load<SpriteFont>("menufont"); lightingEngine.LoadContent(content, ScreenManager.GraphicsDevice, ScreenManager.SpriteBatch); enemyController = new EnemyController(); enemyController.LoadContent(content, ScreenManager.GraphicsDevice, lightingEngine); particleController = new ParticleController(); particleController.LoadContent(content); projectileController = new ProjectileController(); projectileController.LoadContent(content); itemController = new ItemController(); itemController.LoadContent(content, ScreenManager.GraphicsDevice, lightingEngine); vehicleController = new VehicleController(); vehicleController.LoadContent(content, ScreenManager.GraphicsDevice, lightingEngine); gameMap = content.Load<Map>("map/map"); gameHud = new Hud(); gameHud.LoadContent(content); mapFog = new bool[gameMap.Width, gameMap.Height]; ThreadPool.QueueUserWorkItem(new WaitCallback(GenerateTerrainAsync)); gameHero = new HeroDude(gameMap.HeroSpawn); gameHero.LoadContent(content, ScreenManager.GraphicsDevice, lightingEngine); gameCamera = new Camera(ScreenManager.GraphicsDevice.Viewport, gameMap); gameCamera.ClampRect = new Rectangle(0, 0, gameMap.Width * gameMap.TileWidth, gameMap.Height * gameMap.TileHeight); gameCamera.ZoomTarget = 1f; //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); //cameraLightSource.Type = LightSourceType.Spot; //lightingEngine.LightSources.Add(cameraLightSource); minimapRT = new RenderTarget2D(ScreenManager.GraphicsDevice, 200, 200); crosshairTex = content.Load<Texture2D>("crosshair"); mapIcons = content.Load<Texture2D>("mapicons"); //lightSource1 = new LightSource(ScreenManager.GraphicsDevice, 600, LightAreaQuality.Low, new Color(1f, 1f, 1f), BeamStencilType.Wide, SpotStencilType.None); //lightingEngine.LightSources.Add(lightSource1); ScreenManager.Game.ResetElapsedTime(); }
/// <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(); }