Пример #1
0
        public Room CreateRoom(int exits)
        {
            //temp room variable
            Room temp = new Room();

            //Array of 1's and 0's to determine where exits and maybe the type of the room eventually
            int[] bin = ToBinary(exits);

            //Compare binary to specific tests
            //1st bit = east
            //2nd = west
            //3rd = south
            //4th = north
            // 5th = up
            // 6th = down
            //7th and 8th may mean type eventually.

            if (bin[0] == 1)
            {
                temp.AddExit("east");
            }
            if (bin[1] == 1)
            {
                temp.AddExit("west");
            }
            if (bin[2] == 1)
            {
                temp.AddExit("south");
            }
            if (bin[3] == 1)
            {
                temp.AddExit("north");
            }
            if (bin[4] == 1)
            {
                temp.AddExit("up");
            }
            if (bin[5] == 1)
            {
                temp.AddExit("down");
            }
            if (bin[6] == 0 && bin[7] == 0)
            {
                temp.changeType("Special");
            }
            if (bin[6] == 0 && bin[7] == 1)
            {
                temp.changeType("Treasures");
            }
            if (bin[6] == 1 && bin[7] == 0)
            {
                temp.changeType("Enemies");
            }
            if (bin[6] == 1 && bin[7] == 1)
            {
                temp.changeType("Boss");
            }

            return new Room();
        }