Exemple #1
0
        /// <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();
        }
Exemple #2
0
 public VehicleController()
 {
     Instance = this;
 }