Ejemplo n.º 1
0
        public string GetAnswerB(bool animate = false)
        {
            var trapRoom = new TrapRoom(File.ReadAllText("Day18_input.txt").Trim());

            trapRoom.AddRows(399999);

            return("" + trapRoom.NumberOfSafeTiles);
        }
Ejemplo n.º 2
0
    public void Start()
    {
        if (Globals.nextTrapRoom != null)
        {
            trapRoom = Globals.nextTrapRoom;
        }

        background.sprite = trapRoom.background;
    }
Ejemplo n.º 3
0
    public void StartTrap(TrapRoom traproom)
    {
        trapRoom = traproom;
        int RandomPuzzle = Random.Range(1, HowManyPuzzles);

        PuzzleScreen1.StartPuzzle(RandomPuzzle, this);
        PuzzleScreen2.ShowPuzzle(RandomPuzzle, this);
        PuzzleScreen3.ShowPuzzle(RandomPuzzle, this);
    }
Ejemplo n.º 4
0
 public static void ResetProgress()
 {
     nextLevel    = null;
     nextTrapRoom = null;
     inventory.Clear();
     hallwayTutorialCompleted  = false;
     minigameTutorialCompleted = false;
     completeMinigames.Clear();
     completedTraps.Clear();
 }
Ejemplo n.º 5
0
        //NOTE Make yo rooms here...
        public void Setup()
        {
            TrapRoom start = new TrapRoom("Start room", "You see a window about a perfect ladders height away.");
            IRoom    two   = new Room("This is the 2nd room", "Another room description");
            IRoom    three = new Room("This room", "Another 3rd room description");

            start.AddRoomConnection(two, "east");
            two.AddRoomConnection(start, "west");
            start.AddRoomConnection(three, "north");
            three.AddRoomConnection(start, "south");

            Item ladder = new Item("Ladder", "A real nice ladder");

            start.Items.Add(ladder);

            start.AddUnlockable(ladder, "You can now climb the ladder out");

            CurrentRoom = start;
        }
Ejemplo n.º 6
0
    public MapInfo(MapSize size)
    {
        rows  = 3; cols = 3;
        rooms = new Room[rows, cols];

        rooms[0, 0] = new NavRoom();
        rooms[0, 1] = new NavRoom();
        rooms[0, 2] = new TrapRoom();

        rooms[1, 1] = new CombatRoom();

        rooms[2, 1] = new NavRoom();
        rooms[2, 0] = new TrapRoom();
        rooms[2, 2] = new NavRoom();

        currRow   = 0; currCol = 0;
        startRoom = rooms[currRow, currCol];

        endRoom = rooms[2, 2];
    }
Ejemplo n.º 7
0
        void Setup()
        {
            // Do the things like create enemies and rooms and assign items to enemies
            var Goblin     = new Enemy("The Goblin Witch", 25);
            var Knight     = new Enemy("The Rusty Knight", 50);
            var ManBearPig = new Enemy("THe MAN BEAR PIG", 200);

            var Sword       = new Weapon("The Sword", 20, 15);
            var MorningStar = new Weapon("The Morning Star", 20, 25);

            // var knight = new Enemy();
            // var monster = new Enemy();
            // var empty = new Enemy();


            PlayerWeapon = new Weapon("The Hammer", 25, 20);

            var room1          = new Room("The Starting Room", "You awake to the sound of violence coming from the north, west to the south it is suspiciously quiet, An acrid smell permeates from the south.");
            var room2          = new Room("North Room", "its bland but there is a grotesque goblin staring at you");
            var room3          = new Room("The West Wing", "You find yourself in a dark space lit by candles, something dark shuffles in the corner...");
            var poisonTrapRoom = new TrapRoom("Poison Room", "smells bad", 300);

            room2.Enemy = (IEnemy)Goblin;
            room3.Enemy = (IEnemy)Knight;
            Knight.EquipWeapon(MorningStar);
            Goblin.EquipWeapon(Sword);

            DeathRoom = poisonTrapRoom;
            room1.Exits.Add("north", room2);
            room1.Exits.Add("south", DeathRoom);
            room1.Exits.Add("west", room3);
            room2.Exits.Add("south", room1);
            room3.Exits.Add("east", room1);



            CurrentRoom  = room1;
            CurrentEnemy = Goblin;

            Start();
        }
Ejemplo n.º 8
0
        ///<summary>
        ///No need to Pass a room since Items can only be used in the CurrentRoom
        ///Make sure you validate the item is in the room or player inventory before
        ///being able to use the item
        ///</summary>
        public void UseItem(string itemName)
        {
            //Found IItem
            //if item from inventory
            //else if not try from room list
            //if still not cant use
            //return

            //RoomItemUse
            //GlobalItemUse



            IRoom room = _game.CurrentRoom;

            if (room is TrapRoom)
            {
                // IItem found = _game.CurrentPlayer.Inventory.Find(itemName);
                // var itemm = _game.CurrentPlayer.Inventory.IndexOf(itemName as Item);
                for (int i = 0; i < _game.CurrentPlayer.Inventory.Count; i++)
                {
                    var item = _game.CurrentPlayer.Inventory[i];
                    if (item.Name.ToLower() == itemName)
                    {
                        TrapRoom trap = (TrapRoom)room;
                        trap.UseItem(item);
                        Messages.Add(trap.UseItem(item));
                        // _game.CurrentPlayer.Inventory.Remove(item);
                        Messages.Add($"Used your {item.Name}");
                        return;
                    }
                }
                {
                    Messages.Add("Invalid Item");
                }
            }
            else if (room is SafeTrapRoom)
            {
                for (int i = 0; i < _game.CurrentPlayer.Inventory.Count; i++)
                {
                    var item = _game.CurrentPlayer.Inventory[i];
                    if (item.Name.ToLower() == itemName)
                    {
                        SafeTrapRoom trap = (SafeTrapRoom)room;
                        Messages.Add(trap.UseItem(item));
                        // _game.CurrentPlayer.Inventory.Remove(item);
                        Messages.Add($"Used your {item.Name}");
                        return;
                    }
                }
                {
                    Messages.Add("Invalid Item");
                }
            }
            else if (room is ThroneRoom)
            {
                for (int i = 0; i < _game.CurrentPlayer.Inventory.Count; i++)
                {
                    var item = _game.CurrentPlayer.Inventory[i];
                    if (item.Name.ToLower() == itemName)
                    {
                        ThroneRoom winningRoom = (ThroneRoom)room;
                        Messages.Add(winningRoom.UseItem(item));
                        return;
                    }
                }
                {
                    Messages.Add("Invalid Item");
                }
            }
            else
            {
                for (int i = 0; i < _game.CurrentPlayer.Inventory.Count; i++)
                {
                    var item = _game.CurrentPlayer.Inventory[i];
                    if (item.Name.ToLower() == itemName)
                    {
                        Messages.Add($"Used your {item.Name} but it has little effect here.");
                        return;
                    }
                }
                {
                    Messages.Add("Invalid Item");
                }
            }
        }
Ejemplo n.º 9
0
        //NOTE Make yo rooms here...
        public void Setup()
        {
            IRoom start = new Room("An Unknown Room", "You come to your senses in a pile of your own vomit.");
            IRoom two   = new Room("Outside", "To your north you hear a loud ruckus but to your west you see somebody disappear down a sewage lid.");
            IRoom three = new TrapRoom("Pub", "The bar is very crowded but there is an open spot off to the side");
            IRoom four  = new TrapRoom("Hidden Tunnel", "There is ancient markings on the walls of this poorly lit corridor the only way to advance is north.");
            IRoom five  = new Room("Courtyard", "You see large arch doors to your north but a smaller normal door to your west.");
            IRoom six   = new TrapRoom("Jailor", "You walk into the room to see a group of guards sitting around a table looking up at you.");
            IRoom seven = new SafeTrapRoom("Dark Hallway", $@"
    You enter the arch doors to a long dark hallway. 
        Do you dare go north?");
            IRoom eight = new ThroneRoom("Throne Room", "There is the Iron Throne with nobody to claim it... Do you dare sit in the throne");
            IRoom nine  = new TrapRoom("Kings Room", "The King is sleeping with his Crown tucked under his arms.... ");

            start.AddRoomConnection(two, "west");
            two.AddRoomConnection(start, "east");

            two.AddRoomConnection(three, "north");
            three.AddRoomConnection(two, "south");

            two.AddRoomConnection(four, "west");
            four.AddRoomConnection(two, "east");

            four.AddRoomConnection(five, "north");
            five.AddRoomConnection(four, "south");

            five.AddRoomConnection(six, "west");
            six.AddRoomConnection(five, "east");

            five.AddRoomConnection(seven, "north");
            seven.AddRoomConnection(five, "south");

            seven.AddRoomConnection(eight, "north");
            eight.AddRoomConnection(seven, "south");

            nine.AddRoomConnection(seven, "east");
            seven.AddRoomConnection(nine, "west");

            eight.AddRoomConnection(start, "secret");



            Item sword = new Item("Sword", "Big long sword");
            Item drink = new Item("Ale", "Biggest container of beer you've ever seen.");
            Item torch = new Item("Torch", "Used to light even the darkest of places.");
            Item crown = new Item("Crown", "Fit for a king");
            Item test  = new Item("Key", "This must open something important");

            start.Items.Add(sword);
            three.Items.Add(drink);
            four.Items.Add(torch);
            nine.Items.Add(crown);
            seven.Items.Add(test);


            (seven as SafeTrapRoom).addUnlockable(test);
            (four as TrapRoom).addUnlockable(torch);
            (six as TrapRoom).addUnlockable(sword);
            (three as TrapRoom).addUnlockable(drink);
            (eight as ThroneRoom).addUnlockable(crown);



            CurrentRoom = start;
        }