Ejemplo n.º 1
0
        public void LoadEnvironmentLevelOne(GamePlayScreen gamePlayScreen, MainGame mGame)
        {
            var castleTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/Castle");
            var forestTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/forest01");
            var bigForestTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/forest_02_big");
            var vertForestTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/forest_03_vert");
            var smallForestTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/forest04_small");
            var longForestTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/forest_05_long");

            var houseTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/old_house");
            var horWallTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/horisontal_wall");
            var verWallShortTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/vertical_wall_short");
            var verWallTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/vertical_wall");
            var treasureChestTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/TreasureChest");
            var hauntedHouseTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/dilapidated_house");

            var castle01 = new StillSprite(castleTexture);
            var forest01 = new StillSprite(forestTexture);
            var forest02 = new StillSprite(forestTexture);
            var forest03 = new StillSprite(forestTexture);
            var forest04 = new StillSprite(forestTexture);
            var forest05 = new StillSprite(forestTexture);
            var forest06 = new StillSprite(forestTexture);
            var bigForest01 = new StillSprite(bigForestTexture);
            var bigForest02 = new StillSprite(bigForestTexture);
            var bigForest03 = new StillSprite(bigForestTexture);
            var bigForest04 = new StillSprite(bigForestTexture);
            var vertForest01 = new StillSprite(vertForestTexture);
            var vertForest02 = new StillSprite(vertForestTexture);
            var vertForest03 = new StillSprite(vertForestTexture);
            var vertForest04 = new StillSprite(vertForestTexture);
            var vertForest05 = new StillSprite(vertForestTexture);
            var vertForest06 = new StillSprite(vertForestTexture);
            var vertForest07 = new StillSprite(vertForestTexture);
            var vertForest08 = new StillSprite(vertForestTexture);
            var smallForest01 = new StillSprite(smallForestTexture);
            var smallForest02 = new StillSprite(smallForestTexture);
            var smallForest03 = new StillSprite(smallForestTexture);
            var smallForest04 = new StillSprite(smallForestTexture);
            var longForest01 = new StillSprite(longForestTexture);
            var oldHouse01 = new StillSprite(houseTexture);
            var oldHouse02 = new StillSprite(houseTexture);
            var oldHouse03 = new StillSprite(houseTexture);
            var horisontalWall01 = new StillSprite(horWallTexture);
            var horisontalWall02 = new StillSprite(horWallTexture);
            var verticalWall01 = new StillSprite(verWallTexture);
            var verticalWallShort01 = new StillSprite(verWallShortTexture);
            var verticalWallShort02 = new StillSprite(verWallShortTexture);

            castle01.Position = new Vector2(50, 50);
            oldHouse01.Position = new Vector2(60, 320);
            oldHouse02.Position = new Vector2(60, 500);
            oldHouse03.Position = new Vector2(260, 50);
            horisontalWall01.Position = new Vector2(0, 0);
            horisontalWall02.Position = new Vector2(0, 850);
            verticalWall01.Position = new Vector2(0, 50);
            verticalWallShort01.Position = new Vector2(550, 50);
            verticalWallShort02.Position = new Vector2(550, 500);

            forest01.Position = new Vector2(600, 0);
            bigForest01.Position = new Vector2(600, 500);
            vertForest01.Position = new Vector2(1400, 0);
            forest02.Position = new Vector2(1600, 600);
            forest03.Position = new Vector2(1600, 1000);
            forest04.Position = new Vector2(600, 1600);
            smallForest01.Position = new Vector2(1800, 1200);
            smallForest03.Position = new Vector2(800, 1100);
            smallForest04.Position = new Vector2(800, 1300);
            vertForest02.Position = new Vector2(1400, 1000);
            vertForest03.Position = new Vector2(2600, 0);
            vertForest04.Position = new Vector2(2600, 800);
            forest05.Position = new Vector2(1600, 1600);
            forest06.Position = new Vector2(1400, 2000);
            bigForest02.Position = new Vector2(0, 1200);
            bigForest03.Position = new Vector2(1800, 200);
            longForest01.Position = new Vector2(0, 2000);
            bigForest04.Position = new Vector2(2600, 1800);
            vertForest05.Position = new Vector2(3000, 1000);
            vertForest06.Position = new Vector2(3000, 200);
            smallForest02.Position = new Vector2(3200, 200);
            vertForest07.Position = new Vector2(3400, 600);
            vertForest08.Position = new Vector2(3400, 1400);

            //treasure chest
            InteractionSprite treasureChest01 = new InteractionSprite(treasureChestTexture, InteractionType.Chest);
            treasureChest01.Position = new Vector2(1270, 30);
            treasureChest01.SetCollisionRectangle();
            InteractionSprite hauntedHouseSprite = new InteractionSprite(hauntedHouseTexture, InteractionType.Entrance, "Haunted house");
            hauntedHouseSprite.Position = new Vector2(0, 2200);
            hauntedHouseSprite.SetCollisionRectangle();
            gamePlayScreen.Interactables = new List<InteractionSprite>()
            {
                treasureChest01,
                hauntedHouseSprite
            };

            foreach (var sprite in gamePlayScreen.Interactables)
            {
                if (sprite.InteractionType == InteractionType.Chest)
                {
                    sprite.Treasure = mGame.Engine.Loot.Treasure;
                }
            }

            gamePlayScreen.environmentSprites = new List<Sprite>
            {
                castle01,
                forest01,
                oldHouse01,
                oldHouse02,
                oldHouse03,
                horisontalWall01,
                horisontalWall02,
                verticalWall01,
                verticalWallShort01,
                verticalWallShort02,
                bigForest01,
                vertForest01,
                forest02,
                vertForest02,
                bigForest02,
                bigForest03,
                vertForest03,
                forest03,
                vertForest04,
                forest04,
                longForest01,
                smallForest01,
                forest05,
                forest06,
                bigForest04,
                vertForest05,
                vertForest06,
                smallForest02,
                vertForest07,
                vertForest08,
                smallForest03,
                smallForest04,

                hauntedHouseSprite
               };
            gamePlayScreen.Interactables.Clear();
            LoadTreasureChests(gamePlayScreen, mGame, treasureChestTexture);
            gamePlayScreen.Interactables.Add(hauntedHouseSprite);
        }
Ejemplo n.º 2
0
 private static void LoadTreasureChests(GamePlayScreen gamePlayScreen, MainGame mGame, Texture2D treasureChestTexture)
 {
     foreach (var chest in mGame.Engine.Loot.TreasureChests)
     {
         var treasure = new InteractionSprite(treasureChestTexture, InteractionType.Chest);
         treasure.Position = new Vector2((float)chest.Location.X, (float)chest.Location.Y);
         treasure.SetCollisionRectangle();
         gamePlayScreen.Interactables.Add(treasure);
         gamePlayScreen.environmentSprites.Add(treasure);
     }
 }