Exemplo n.º 1
0
        public override void LoadContent()
        {
            switchCamera();

            midTerrain = new Vector3(terrain.terrainWidth / 2, waterLevel, terrain.terrainLength / 2);

            //Create water
            water = new WaterBase(midTerrain, waterLevel, new Vector2(terrain.TerrainWidth, terrain.TerrainLength), baseWaterKey, waveKey, baseWaterRowX, baseWaterRowY, "water", amountWaves, Game);
            Game.Components.Add(water);

            //Adding the models
            Models.AddModels addModels = new Models.AddModels(Game, models, terrain, modelmapKey, Game.Content);

            foreach (Models.LFModel model in models)
            {
                if (!Game.Components.Contains(model))
                {
                    Game.Components.Add(model);
                }
            }

            //Load songs.
            this.smallFireSong       = Game.Assets.Load <Song>("flamesmall");
            this.mediumFireSong      = Game.Assets.Load <Song>("flamemedium");
            this.bigFireSong         = Game.Assets.Load <Song>("flamebig");
            this.songPlayTimeCounter = 0;
            this.currentlyPlaying    = this.smallFireSong;
            MediaPlayer.Play(this.currentlyPlaying);

            //Load Soundeffects.
            SoundEffect s = Game.Assets.Load <SoundEffect>("collectmeteor");

            this.collectMeteorInstance = s.CreateInstance();
            s = Game.Assets.Load <SoundEffect>("treefall");
            this.treeFallInstance = s.CreateInstance();
            s = Game.Assets.Load <SoundEffect>("watersplash");
            this.waterSplash = s.CreateInstance();
            s = Game.Assets.Load <SoundEffect>("burnsomething");
            this.burnSomething = s.CreateInstance();
            s = Game.Assets.Load <SoundEffect>("collectstar");
            this.collectStarInstance = s.CreateInstance();

            foreach (Models.LFModel model in models)
            {
                if (model is Coal)
                {
                    Vector3 pos = model.Position + new Vector3(0, 0.5f, -1.5f);
                    BillBoard.HorizontalBillboarding circle = new BillBoard.HorizontalBillboarding(pos, pos.Y, new Vector2(6), Game.Assets.Load <Texture2D>("circle"), 1, 1, Game.GraphicsDevice, Game.Content, Game);
                    Game.Components.Add(circle);
                }
                else if (model is Meteoriet)
                {
                    Vector3 pos = model.Position + new Vector3(0, 32, 0);
                    BillBoard.VerticalBillBoard beam = new BillBoard.VerticalBillBoard(pos, pos.Y, new Vector2(6, 50), Game.Assets.Load <Texture2D>("lightbeam"), 1, 1, Game.GraphicsDevice, Game.Content, Game);
                    Game.Components.Add(beam);
                }
                else if (model is Tree && this is States.GreenHills.Tutorial)
                {
                    Vector3 pos = model.Position + new Vector3(0, 0.5f, 0f);
                    BillBoard.HorizontalBillboarding circle = new BillBoard.HorizontalBillboarding(pos, pos.Y, new Vector2(7), Game.Assets.Load <Texture2D>("circletree"), 1, 1, Game.GraphicsDevice, Game.Content, Game);
                    Game.Components.Add(circle);
                }
            }

            foreach (Models.LFModel model in models)
            {
                if (model is Meteoriet)
                {
                    Vector3 pos = model.Position + new Vector3(0.5f, 0.5f, 0f);
                    BillBoard.HorizontalBillboarding circle = new BillBoard.HorizontalBillboarding(pos, pos.Y, new Vector2(8), Game.Assets.Load <Texture2D>("circle"), 1, 1, Game.GraphicsDevice, Game.Content, Game);
                    Game.Components.Add(circle);
                }
            }

            // If there is a load file, load the game from that point.
            if (loadName != "")
            {
                loadProgress(loadName);
            }

            //Set the player's position
            player.Position = this.terrain.GetHeightAtPosition(startPosition.X, startPosition.Z, 0);

            //Create the sky
            sky = new Sky(Game, Game.Assets.Load <TextureCube>("sky"));
            Game.Components.Add(sky);
        }
Exemplo n.º 2
0
        public override void LoadContent()
        {
            switchCamera();

            midTerrain = new Vector3(terrain.terrainWidth / 2, waterLevel, terrain.terrainLength / 2);

              //Create water
            water = new WaterBase(midTerrain, waterLevel, new Vector2(terrain.TerrainWidth, terrain.TerrainLength), baseWaterKey, waveKey, baseWaterRowX, baseWaterRowY, "water", amountWaves, Game);
            Game.Components.Add(water);

            //Adding the models
            Models.AddModels addModels = new Models.AddModels(Game, models, terrain, modelmapKey, Game.Content);

            foreach (Models.LFModel model in models)
                if (!Game.Components.Contains(model))
                    Game.Components.Add(model);

            //Load songs.
            this.smallFireSong = Game.Assets.Load<Song>("flamesmall");
            this.mediumFireSong = Game.Assets.Load<Song>("flamemedium");
            this.bigFireSong = Game.Assets.Load<Song>("flamebig");
            this.songPlayTimeCounter = 0;
            this.currentlyPlaying = this.smallFireSong;
            MediaPlayer.Play(this.currentlyPlaying);

            //Load Soundeffects.
            SoundEffect s = Game.Assets.Load<SoundEffect>("collectmeteor");
            this.collectMeteorInstance = s.CreateInstance();
            s = Game.Assets.Load<SoundEffect>("treefall");
            this.treeFallInstance = s.CreateInstance();
            s = Game.Assets.Load<SoundEffect>("watersplash");
            this.waterSplash = s.CreateInstance();
            s = Game.Assets.Load<SoundEffect>("burnsomething");
            this.burnSomething = s.CreateInstance();
            s = Game.Assets.Load<SoundEffect>("collectstar");
            this.collectStarInstance = s.CreateInstance();

            foreach (Models.LFModel model in models) {
                if (model is Coal) {
                    Vector3 pos = model.Position + new Vector3(0, 0.5f, -1.5f);
                    BillBoard.HorizontalBillboarding circle = new BillBoard.HorizontalBillboarding(pos, pos.Y, new Vector2(6), Game.Assets.Load<Texture2D>("circle"), 1, 1, Game.GraphicsDevice, Game.Content, Game);
                    Game.Components.Add(circle);
                } else if (model is Meteoriet) {
                    Vector3 pos = model.Position + new Vector3(0, 32, 0);
                    BillBoard.VerticalBillBoard beam = new BillBoard.VerticalBillBoard(pos, pos.Y, new Vector2(6, 50), Game.Assets.Load<Texture2D>("lightbeam"), 1, 1, Game.GraphicsDevice, Game.Content, Game);
                    Game.Components.Add(beam);
                } else if (model is Tree && this is States.GreenHills.Tutorial) {
                    Vector3 pos = model.Position + new Vector3(0, 0.5f, 0f);
                    BillBoard.HorizontalBillboarding circle = new BillBoard.HorizontalBillboarding(pos, pos.Y, new Vector2(7), Game.Assets.Load<Texture2D>("circletree"), 1, 1, Game.GraphicsDevice, Game.Content, Game);
                    Game.Components.Add(circle);
                }
            }

            foreach (Models.LFModel model in models) {
                if (model is Meteoriet) {
                    Vector3 pos = model.Position + new Vector3(0.5f, 0.5f, 0f);
                    BillBoard.HorizontalBillboarding circle = new BillBoard.HorizontalBillboarding(pos, pos.Y, new Vector2(8), Game.Assets.Load<Texture2D>("circle"), 1, 1, Game.GraphicsDevice, Game.Content, Game);
                    Game.Components.Add(circle);
                }
            }

            // If there is a load file, load the game from that point.
            if (loadName != "") {
                loadProgress(loadName);
            }

            //Set the player's position
            player.Position = this.terrain.GetHeightAtPosition(startPosition.X, startPosition.Z, 0);

            //Create the sky
            sky = new Sky(Game, Game.Assets.Load<TextureCube>("sky"));
            Game.Components.Add(sky);
        }