/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { AudioController.LoadContent(Content); // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here gameMap = Content.Load <Map>("map"); gameHud = new Hud(); gameHud.LoadContent(Content); gameTriggerController = new TriggerController(gameMap); gamePromptController = new PromptController(); gamePromptController.LoadContent(Content); blankTex = Content.Load <Texture2D>("blank"); skyGradient = Content.Load <Texture2D>("sky-gradient"); cloudTexture = Content.Load <Texture2D>("cloud-test"); valveTexture = Content.Load <Texture2D>("valve"); int layerCount = 0; foreach (Layer ml in gameMap.Layers) { if (ml is TileLayer) { layerCount++; } } LayerDepths = new float[layerCount]; LayerColors = new Color[layerCount]; float scale = 1f; for (int i = 0; i < LayerDepths.Length; i++) { LayerDepths[i] = scale; LayerColors[i] = new Color((1f - (scale * 0.5f)) * 0.4f, (1f - (scale * 0.5f)) * 0.5f, (1f - (scale * 0.5f)) * 0.9f);//Color.White * (scale * 0.5f); if (scale > 0f) { scale -= 0.33333f; } } gameHero = new Hero(Helper.PtoV((gameMap.GetLayer("Spawn") as MapObjectLayer).Objects[0].Location.Center)); gameHero.LoadContent(Content, GraphicsDevice); gameCamera = new Camera(GraphicsDevice.Viewport, gameMap); gameCamera.Position = gameHero.Position; gameCamera.Target = gameHero.Position; for (scale = 1.5f; scale > -5f; scale -= 0.1f) { Waters.Add(new Water(GraphicsDevice, gameMap, new Rectangle(-GraphicsDevice.Viewport.Bounds.Width, (gameMap.Height * gameMap.TileHeight) - waterLevel, ((gameMap.Width * gameMap.TileWidth) * 2) + GraphicsDevice.Viewport.Bounds.Width, 400 + waterLevel), new Color(50, 128, 255), Color.Black, scale)); } for (scale = 1.5f; scale > -5f; scale -= 0.1f) { Clouds.Add(new Vector4(rand.Next(1920), 1000f, scale, 0f)); } ambient1 = Content.Load <SoundEffect>("sfx/ambient1").CreateInstance(); ambient2 = Content.Load <SoundEffect>("sfx/ambient2").CreateInstance(); water = Content.Load <SoundEffect>("sfx/water").CreateInstance(); ambient1.Volume = 0f; ambient2.Volume = 0f; water.Volume = 0f; ambient1.IsLooped = true; ambient2.IsLooped = true; water.IsLooped = true; ambient1.Play(); ambient2.Play(); water.Play(); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { AudioController.LoadContent(Content); // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here gameMap = Content.Load<Map>("map"); gameHud = new Hud(); gameHud.LoadContent(Content); gameTriggerController = new TriggerController(gameMap); gamePromptController = new PromptController(); gamePromptController.LoadContent(Content); blankTex = Content.Load<Texture2D>("blank"); skyGradient = Content.Load<Texture2D>("sky-gradient"); cloudTexture = Content.Load<Texture2D>("cloud-test"); valveTexture = Content.Load<Texture2D>("valve"); int layerCount = 0; foreach (Layer ml in gameMap.Layers) if (ml is TileLayer) layerCount++; LayerDepths = new float[layerCount]; LayerColors = new Color[layerCount]; float scale = 1f; for (int i = 0; i < LayerDepths.Length; i++) { LayerDepths[i] = scale; LayerColors[i] = new Color((1f - (scale * 0.5f)) * 0.4f, (1f - (scale * 0.5f)) * 0.5f, (1f - (scale * 0.5f)) * 0.9f);//Color.White * (scale * 0.5f); if (scale > 0f) scale -= 0.33333f; } gameHero = new Hero(Helper.PtoV((gameMap.GetLayer("Spawn") as MapObjectLayer).Objects[0].Location.Center)); gameHero.LoadContent(Content, GraphicsDevice); gameCamera = new Camera(GraphicsDevice.Viewport, gameMap); gameCamera.Position = gameHero.Position; gameCamera.Target = gameHero.Position; for (scale = 1.5f; scale > -5f; scale -= 0.1f) { Waters.Add(new Water(GraphicsDevice, gameMap, new Rectangle(-GraphicsDevice.Viewport.Bounds.Width, (gameMap.Height * gameMap.TileHeight) - waterLevel, ((gameMap.Width * gameMap.TileWidth) * 2) + GraphicsDevice.Viewport.Bounds.Width, 400 + waterLevel), new Color(50, 128, 255), Color.Black, scale)); } for (scale = 1.5f; scale > -5f; scale -= 0.1f) { Clouds.Add(new Vector4(rand.Next(1920), 1000f, scale, 0f)); } ambient1 = Content.Load<SoundEffect>("sfx/ambient1").CreateInstance(); ambient2 = Content.Load<SoundEffect>("sfx/ambient2").CreateInstance(); water = Content.Load<SoundEffect>("sfx/water").CreateInstance(); ambient1.Volume = 0f; ambient2.Volume = 0f; water.Volume = 0f; ambient1.IsLooped = true; ambient2.IsLooped = true; water.IsLooped = true; ambient1.Play(); ambient2.Play(); water.Play(); }
public Hud() { Instance = this; }