示例#1
0
        public Level()
        {
            _startRoomIndex = 0;
            _rooms          = new List <Room>();
            var room1 = new Room("Room1.f");
            var room2 = new Room("Room2.f");
            var room3 = new Room("Room1.f");
            var room4 = new Room("Room2.f");
            var room5 = new Room("Room1.f");
            var room6 = new Room("Room2.f");

            var room7 = new BossRoom(new RectangleF(-0.85f, 0.5f, 1.7f, -1.4f), 3,
                                     new Boss(0.15f, -0.25f, 0.3f, 0.2f, 0.2f / 60, 1200, 7, 16, new ShotCharacteristics("Fireball.f"),
                                              30, 4, 0.22f / 60, 1, "Boss", Boss.ShootRound10));

            var trueState = new[] { 0, 2, 2 };
            var note      = new Note(new RectangleF(0.5f, 0.5f, 0.2f, 0.2f), 0, 1, trueState);
            var room8     = new ChallengeRoom(new RectangleF(-0.85f, 0.5f, 1.7f, -1.4f), 1, note);

            room1.TopDoor   = new Door(room1, room2, "top");
            room2.BotDoor   = new Door(room2, room1, "bot");
            room2.RightDoor = new Door(room2, room3, "right");
            room3.LeftDoor  = new Door(room3, room2, "left");
            room3.RightDoor = new Door(room3, room4, "right");
            room4.TopDoor   = new Door(room4, room5, "top");
            room4.LeftDoor  = new Door(room4, room3, "left");
            room4.BotDoor   = new Door(room4, room6, "bot");
            room5.BotDoor   = new Door(room5, room4, "bot");
            room6.TopDoor   = new Door(room6, room4, "top");
            room6.BotDoor   = new Door(room6, room7, "bot");
            room7.TopDoor   = new Door(room7, room6, "top");
            room7.Items.Add(new Item(room7.Form.Left + 0.5f, room7.Form.Bottom + 0.5f,
                                     ItemEffect.UpSpeed, "Boot.f"));
            _bossRoom     = room7;
            room5.TopDoor = new Door(room5, room8, "top");
            room8.BotDoor = new Door(room8, room5, "bot");

            _rooms.Add(room1);
            _rooms.Add(room2);
            _rooms.Add(room3);
            _rooms.Add(room4);
            _rooms.Add(room5);
            _rooms.Add(room6);
            _rooms.Add(room7);
            _rooms.Add(room8);

            foreach (var t in _rooms)
            {
                _roomSupervisors[t] = new DefaultRoomSupervisor(t);
            }
            _currentRoom = _rooms[_startRoomIndex];

            //room1.Enemies.Clear();
        }
示例#2
0
        public void Draw(ChallengeRoom room)
        {
            GL.BindTexture(TextureTarget.Texture2D, _textures[room.Texture]);

            new RectangleDrawer().Draw(room.Form);

            var borderDrawer = new RoomBorderDrawer(_textures);

            borderDrawer.Draw(room, room.Border);

            var leverDrawer = new LeverDrawer(_textures);

            foreach (var t in room.Levers)
            {
                leverDrawer.Draw(t);
            }

            foreach (var t in room.Shots)
            {
                var shotDrawer = new ShotDrawer(_textures);
                shotDrawer.Draw(t);
            }

            foreach (var t in room.Items)
            {
                if (t.IsAvailable)
                {
                    var itemDrawer = new ItemDrawer(_textures);
                    itemDrawer.Draw(t);
                }
            }

            new NoteDrawer(_textures).Draw(room.Note);

            var doorDrawer = new DoorDrawer(_textures);

            if (room.TopDoor != null)
            {
                doorDrawer.Draw(room.TopDoor);
            }
            if (room.BotDoor != null)
            {
                doorDrawer.Draw(room.BotDoor);
            }
            if (room.LeftDoor != null)
            {
                doorDrawer.Draw(room.LeftDoor);
            }
            if (room.RightDoor != null)
            {
                doorDrawer.Draw(room.RightDoor);
            }
        }
示例#3
0
        public Level GetLevel(List <string> itemNames, Dictionary <string, Item.ItemEffect> itemEffects,
                              List <string> fileNames)
        {
            var  rooms = new List <Room>();
            Room room1 = new Room(fileNames[random.Next(fileNames.Count)]);
            Room room2 = new Room(fileNames[random.Next(fileNames.Count)]);
            Room room3 = new Room(fileNames[random.Next(fileNames.Count)]);
            Room room4 = new Room(fileNames[random.Next(fileNames.Count)]);


            var room5 = new BossRoom(new RectangleF(-0.85f, 0.5f, 1.7f, -1.4f), 58,
                                     new Boss(0.15f, -0.25f, 296.0f / 1500, 458.0f / 1500, 0.2f / 60, 1200, 55, 56, new ShotCharacteristics("Book.f"),
                                              26, 3, 0.35f / 60, 1.7f * 4 / 5, "Boss", Boss.SummonUp));

            room5.Border.Texture = 59;

            int[] trueState = new int[] { 0, 2, 2 };
            var   note      = new Note(new RectangleF(-0.3f, 0.0f, 0.2f, -0.2f), 75, 76, trueState);
            var   room6     = new ChallengeRoom(new RectangleF(-0.85f, 0.5f, 1.7f, -1.4f), 2, note);

            room6.Border.Texture = 59;

            room1.RightDoor = new Door(room1, room2, "right");
            room2.LeftDoor  = new Door(room2, room1, "left");

            room2.RightDoor = new Door(room2, room3, "right");
            room3.LeftDoor  = new Door(room3, room2, "left");

            room3.BotDoor = new Door(room3, room4, "bot");
            room4.TopDoor = new Door(room4, room3, "top");

            room3.TopDoor = new Door(room3, room6, "top");
            room6.BotDoor = new Door(room6, room3, "bot");

            room4.RightDoor = new Door(room4, room5, "right");
            room5.LeftDoor  = new Door(room5, room4, "left");

            room1.Enemies.Clear();
            int itemIndex = random.Next(itemNames.Count);

            room5.Items.Add(new Item(room5.Form.Left + 0.5f, room5.Form.Bottom + 0.5f,
                                     itemEffects[itemNames[itemIndex]], itemNames[itemIndex] + ".f"));
            itemNames.Remove(itemNames[itemIndex]);

            itemIndex = random.Next(itemNames.Count);
            room6.Items.Add(new Item(room6.Form.Left + 0.5f, room6.Form.Bottom + 0.5f,
                                     itemEffects[itemNames[itemIndex]], itemNames[itemIndex] + ".f"));
            itemNames.Remove(itemNames[itemIndex]);

            rooms.Add(room1);
            rooms.Add(room2);
            rooms.Add(room3);
            rooms.Add(room4);
            rooms.Add(room5);
            rooms.Add(room6);


            foreach (var t in rooms)
            {
                var n = random.Next(100);
                if (n <= 20)
                {
                    t.Items.Add(new Item(t.Form.Left + 0.7f, t.Form.Bottom + 0.7f,
                                         ItemEffect.UpHealth, "Heart.f"));
                }
            }

            return(new Level(rooms, room5, 0));
        }
示例#4
0
        public Level GetLevel(List <string> itemNames, Dictionary <string, Item.ItemEffect> itemEffects,
                              List <string> fileNames)
        {
            var rooms = new List <Room>();

            Room room1 = new Room(fileNames[random.Next(fileNames.Count)]);
            Room room2 = new Room(fileNames[random.Next(fileNames.Count)]);
            Room room3 = new Room(fileNames[random.Next(fileNames.Count)]);
            Room room4 = new Room(fileNames[random.Next(fileNames.Count)]);
            Room room5 = new Room(fileNames[random.Next(fileNames.Count)]);
            Room room6 = new Room(fileNames[random.Next(fileNames.Count)]);

            var room7 = new BossRoom(new RectangleF(-0.85f, 0.5f, 1.7f, -1.4f), 3,
                                     new Boss(0.15f, -0.25f, 0.3f, 0.2f, 0.2f / 60, 1200, 26, 27, new ShotCharacteristics("Fireball.f"),
                                              20, 1, 0.22f / 60, 1.7f * 2 / 5, "Boss", Boss.ShootRound5));

            int[] trueState = new int[] { 0, 2, 2 };
            var   note      = new Note(new RectangleF(-0.3f, 0.0f, 0.2f, -0.2f), 75, 76, trueState);
            var   room8     = new ChallengeRoom(new RectangleF(-0.85f, 0.5f, 1.7f, -1.4f), 2, note);

            room1.TopDoor   = new Door(room1, room2, "top");
            room2.BotDoor   = new Door(room2, room1, "bot");
            room2.RightDoor = new Door(room2, room3, "right");
            room3.LeftDoor  = new Door(room3, room2, "left");
            room3.RightDoor = new Door(room3, room4, "right");
            room4.TopDoor   = new Door(room4, room5, "top");
            room4.LeftDoor  = new Door(room4, room3, "left");
            room4.BotDoor   = new Door(room4, room6, "bot");
            room5.BotDoor   = new Door(room5, room4, "bot");
            room6.TopDoor   = new Door(room6, room4, "top");
            room6.BotDoor   = new Door(room6, room7, "bot");
            room7.TopDoor   = new Door(room7, room6, "top");
            room5.TopDoor   = new Door(room5, room8, "top");
            room8.BotDoor   = new Door(room8, room5, "bot");

            room1.Enemies.Clear();
            int itemIndex = random.Next(itemNames.Count);

            room7.Items.Add(new Item(room7.Form.Left + 0.5f, room7.Form.Bottom + 0.5f,
                                     itemEffects[itemNames[itemIndex]], itemNames[itemIndex] + ".f"));
            itemNames.Remove(itemNames[itemIndex]);

            itemIndex = random.Next(itemNames.Count);
            room8.Items.Add(new Item(room8.Form.Left + 0.5f, room8.Form.Bottom + 0.5f,
                                     itemEffects[itemNames[itemIndex]], itemNames[itemIndex] + ".f"));
            itemNames.Remove(itemNames[itemIndex]);

            rooms.Add(room1);
            rooms.Add(room2);
            rooms.Add(room3);
            rooms.Add(room4);
            rooms.Add(room5);
            rooms.Add(room6);
            rooms.Add(room7);
            rooms.Add(room8);

            foreach (var t in rooms)
            {
                var n = random.Next(100);
                if (n <= 20)
                {
                    t.Items.Add(new Item(t.Form.Left + 0.7f, t.Form.Bottom + 0.7f,
                                         ItemEffect.UpHealth, "Heart.f"));
                }
            }

            //room1.Enemies.Add(new Enemy(room1.Form.Left + 0.5f, room1.Form.Bottom + 0.5f, 400.0f / 1500,
            //    266.0f / 1500, 0.1f / 60, 1200, 51, 52, new ShotCharacteristics("Mel.f"), 14, 3, 0.18f / 60, room1.Form.Width,
            //    "Blackboard"));

            //room1.Enemies.Add(new Enemy(room1.Form.Left + 0.5f, room1.Form.Bottom + 0.5f, 400.0f / 1750,
            //    380.0f / 1750, 0.3f / 60, 800, 53, 54, new ShotCharacteristics("Book.f"), 14, 2, 0.18f / 60, room1.Form.Width * 4 / 5,
            //    "Bag"));

            //room1.Enemies.Add(new Enemy(room1.Form.Left + 0.15f,
            //    room1.Form.Bottom + 0.18f + 0.15f, "Blackboard.f"));

            //room1.Enemies.Add(new Enemy(room1.Form.Left + 0.15f,
            //    room1.Form.Top - 0.15f, "Bag.f"));

            //room1.Enemies.Add(new Enemy(room1.Form.Left + 0.15f,
            //    room1.Form.Top - 0.15f, "Ghost.f"));

            return(new Level(rooms, room7, 0));
        }
示例#5
0
        public Level GetLevel(List <string> itemNames, Dictionary <string, Item.ItemEffect> itemEffects,
                              List <string> fileNames)
        {
            var  rooms = new List <Room>();
            Room room1 = new Room(fileNames[random.Next(fileNames.Count)]);
            Room room2 = new Room(fileNames[random.Next(fileNames.Count)]);
            Room room3 = new Room(fileNames[random.Next(fileNames.Count)]);
            Room room4 = new Room(fileNames[random.Next(fileNames.Count)]);
            Room room5 = new Room(fileNames[random.Next(fileNames.Count)]);
            Room room6 = new Room(fileNames[random.Next(fileNames.Count)]);
            Room room7 = new Room(fileNames[random.Next(fileNames.Count)]);

            var room8 = new BossRoom(new RectangleF(-0.85f, 0.5f, 1.7f, -1.4f), 43,
                                     new Boss(-0.35f, -0.25f, 296.0f / 1500, 458.0f / 1500, 0.2f / 60, 1050, 47, 48, new ShotCharacteristics("Fireball.f"),
                                              22, 2, 0.22f / 60, 1.7f * 3 / 5, "Boss", Boss.ShootRound10));

            room8.Border.Texture = 46;

            int[] trueState = new int[] { 2, 0, 1 };
            var   note      = new Note(new RectangleF(-0.3f, 0.0f, 0.2f, -0.2f), 75, 77, trueState);
            var   room9     = new ChallengeRoom(new RectangleF(-0.85f, 0.5f, 1.7f, -1.4f), 2, note);

            room9.Border.Texture = 46;

            room1.BotDoor = new Door(room1, room2, "bot");
            room2.TopDoor = new Door(room2, room1, "top");

            room2.BotDoor = new Door(room2, room3, "bot");
            room3.TopDoor = new Door(room3, room2, "top");

            room1.TopDoor = new Door(room1, room9, "top");
            room9.BotDoor = new Door(room9, room1, "bot");

            room2.RightDoor = new Door(room2, room4, "right");
            room4.LeftDoor  = new Door(room4, room2, "left");

            room4.RightDoor = new Door(room4, room5, "right");
            room5.LeftDoor  = new Door(room5, room4, "left");

            room3.LeftDoor  = new Door(room3, room6, "left");
            room6.RightDoor = new Door(room6, room3, "right");

            room6.LeftDoor  = new Door(room6, room7, "left");
            room7.RightDoor = new Door(room7, room6, "right");

            room7.BotDoor = new Door(room7, room8, "bot");
            room8.TopDoor = new Door(room8, room7, "top");

            room1.Enemies.Clear();
            int itemIndex = random.Next(itemNames.Count);

            room8.Items.Add(new Item(room8.Form.Left + 0.5f, room8.Form.Bottom + 0.5f,
                                     itemEffects[itemNames[itemIndex]], itemNames[itemIndex] + ".f"));
            itemNames.Remove(itemNames[itemIndex]);

            itemIndex = random.Next(itemNames.Count);
            room9.Items.Add(new Item(room9.Form.Left + 0.5f, room9.Form.Bottom + 0.5f,
                                     itemEffects[itemNames[itemIndex]], itemNames[itemIndex] + ".f"));
            itemNames.Remove(itemNames[itemIndex]);

            rooms.Add(room1);
            rooms.Add(room2);
            rooms.Add(room3);
            rooms.Add(room4);
            rooms.Add(room5);
            rooms.Add(room6);
            rooms.Add(room7);
            rooms.Add(room8);
            rooms.Add(room9);

            foreach (var t in rooms)
            {
                var n = random.Next(100);
                if (n <= 20)
                {
                    t.Items.Add(new Item(t.Form.Left + 0.7f, t.Form.Bottom + 0.7f,
                                         ItemEffect.UpHealth, "Heart.f"));
                }
            }

            return(new Level(rooms, room8, 0));
        }