示例#1
0
    PreRoom OneDoorThreeWalls(PreRoom _theRoom)
    {
        PreRoom theRoom = _theRoom;

        // We done bruh
        theRoom.roomState = 2;

        return(theRoom);
    }
示例#2
0
    PreRoom OneDoorOneWall(PreRoom _theRoom)
    {
        PreRoom theRoom = _theRoom;
        Vector2 otherPos;

        bool setTop   = true;
        bool setRight = true;
        bool setDown  = true;
        bool setLeft  = true;

        if (theRoom.up != 0)
        {
            setTop = false;
        }

        if (theRoom.right != 0)
        {
            setRight = false;
        }

        if (theRoom.down != 0)
        {
            setDown = false;
        }

        if (theRoom.left != 0)
        {
            setLeft = false;
        }

        bool randCheck = true;
        int  randVal   = 0;

        if (setTop)
        {
            // Set room to the top
            otherPos    = theRoom.pos;
            otherPos.y += 1;

            // See if we place a door or a wall
            if (randCheck)
            {
                randVal = Random.Range(0, 2);
            }

            if (randVal == 0)
            {
                randCheck = false;
            }

            if (randCheck)
            {
                theRoom.up = 2;
                roomLayout[(int)otherPos.x, (int)otherPos.y].down = 2;
            }
            else
            {
                theRoom.up = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].down      = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
            }

            randCheck = true;
        }

        if (setRight)
        {
            // Set room to the top
            otherPos    = theRoom.pos;
            otherPos.x += 1;

            // See if we place a door or a wall
            if (randCheck)
            {
                randVal = Random.Range(0, 2);
            }

            if (randVal == 0)
            {
                randCheck = false;
            }

            if (randCheck)
            {
                theRoom.right = 2;
                roomLayout[(int)otherPos.x, (int)otherPos.y].left = 2;
            }
            else
            {
                theRoom.right = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].left      = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
            }

            randCheck = true;
        }

        if (setDown)
        {
            // Set room to the top
            otherPos    = theRoom.pos;
            otherPos.y -= 1;

            // See if we place a door or a wall
            if (randCheck)
            {
                randVal = Random.Range(0, 2);
            }

            if (randVal == 0)
            {
                randCheck = false;
            }

            if (randCheck)
            {
                theRoom.down = 2;
                roomLayout[(int)otherPos.x, (int)otherPos.y].up = 2;
            }
            else
            {
                theRoom.down = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].up        = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
            }

            randCheck = true;
        }

        if (setLeft)
        {
            // Set room to the top
            otherPos    = theRoom.pos;
            otherPos.x -= 1;

            // See if we place a door or a wall
            if (randCheck)
            {
                randVal = Random.Range(0, 2);
            }

            if (randVal == 0)
            {
                randCheck = false;
            }

            if (randCheck)
            {
                theRoom.left = 2;
                roomLayout[(int)otherPos.x, (int)otherPos.y].right = 2;
            }
            else
            {
                theRoom.left = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].right     = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
            }

            randCheck = true;
        }

        theRoom.roomState = 2;

        return(theRoom);
    }
示例#3
0
    PreRoom OneDoorThreeVacant(PreRoom _theRoom)
    {
        PreRoom theRoom = _theRoom;
        int     vacant  = Random.Range(0, 3);
        Vector2 otherPos;

        bool setTop   = true;
        bool setRight = true;
        bool setDown  = true;
        bool setLeft  = true;

        bool up    = false;
        bool right = false;
        bool down  = false;
        bool left  = false;

        if (theRoom.up == 1)
        {
            up = true;
        }

        if (theRoom.right == 1)
        {
            right = true;
        }

        if (theRoom.down == 1)
        {
            down = true;
        }

        if (theRoom.left == 1)
        {
            left = true;
        }

        if (up)
        {
            setTop = false;
            if (vacant == 0)
            {
                theRoom.right = 2;
                theRoom.down  = 1;
                theRoom.left  = 1;
            }
            else if (vacant == 1)
            {
                theRoom.right = 1;
                theRoom.down  = 2;
                theRoom.left  = 1;
            }
            else if (vacant == 2)
            {
                theRoom.right = 1;
                theRoom.down  = 1;
                theRoom.left  = 2;
            }
        }

        if (right)
        {
            setRight = false;
            if (vacant == 0)
            {
                theRoom.up   = 2;
                theRoom.down = 1;
                theRoom.left = 1;
            }
            else if (vacant == 1)
            {
                theRoom.up   = 1;
                theRoom.down = 2;
                theRoom.left = 1;
            }
            else if (vacant == 2)
            {
                theRoom.up   = 1;
                theRoom.down = 1;
                theRoom.left = 2;
            }
        }

        if (down)
        {
            setDown = false;
            if (vacant == 0)
            {
                theRoom.up    = 2;
                theRoom.right = 1;
                theRoom.left  = 1;
            }
            else if (vacant == 1)
            {
                theRoom.up    = 1;
                theRoom.right = 2;
                theRoom.left  = 1;
            }
            else if (vacant == 2)
            {
                theRoom.up    = 1;
                theRoom.right = 1;
                theRoom.left  = 2;
            }
        }

        if (left)
        {
            setLeft = false;
            if (vacant == 0)
            {
                theRoom.up    = 2;
                theRoom.right = 1;
                theRoom.down  = 1;
            }
            else if (vacant == 1)
            {
                theRoom.up    = 1;
                theRoom.right = 2;
                theRoom.down  = 1;
            }
            else if (vacant == 2)
            {
                theRoom.up    = 1;
                theRoom.right = 1;
                theRoom.down  = 2;
            }
        }

        if (setTop)
        {
            // Set room to the top
            otherPos    = theRoom.pos;
            otherPos.y += 1;
            if (theRoom.up == 1)
            {
                roomLayout[(int)otherPos.x, (int)otherPos.y].down      = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
            }
            else if (theRoom.up == 2)
            {
                roomLayout[(int)otherPos.x, (int)otherPos.y].down = 2;
            }

            theRoom.roomState = 2;
        }

        if (setRight)
        {
            // Set room to the right
            otherPos    = theRoom.pos;
            otherPos.x += 1;
            if (theRoom.right == 1)
            {
                roomLayout[(int)otherPos.x, (int)otherPos.y].left      = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
            }
            else if (theRoom.right == 2)
            {
                roomLayout[(int)otherPos.x, (int)otherPos.y].left = 2;
            }

            theRoom.roomState = 2;
        }

        if (setDown)
        {
            // Set room to the bottom
            otherPos    = theRoom.pos;
            otherPos.y -= 1;
            if (theRoom.down == 1)
            {
                roomLayout[(int)otherPos.x, (int)otherPos.y].up        = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
            }
            else if (theRoom.down == 2)
            {
                roomLayout[(int)otherPos.x, (int)otherPos.y].up = 2;
            }

            theRoom.roomState = 2;
        }

        if (setLeft)
        {
            // Set room to the left
            otherPos    = theRoom.pos;
            otherPos.x -= 1;
            if (theRoom.left == 1)
            {
                roomLayout[(int)otherPos.x, (int)otherPos.y].left      = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
            }
            else if (theRoom.down == 2)
            {
                roomLayout[(int)otherPos.x, (int)otherPos.y].left = 2;
            }

            theRoom.roomState = 2;
        }

        return(theRoom);
    }
示例#4
0
    bool PlaceRooms()
    {
        int size  = availableRooms.Length;
        int index = Random.Range(0, size);

        Vector2 temp = availableRooms[index];
        int     x    = (int)temp.x;
        int     y    = (int)temp.y;

        PreRoom theRoom = roomLayout[x, y];

        // Check for type of room
        int numDoors = 0;
        int numWalls = 0;

        if (theRoom.up == 1)
        {
            numDoors++;
        }
        else if (theRoom.up == 2)
        {
            numWalls++;
        }

        if (theRoom.right == 1)
        {
            numDoors++;
        }
        else if (theRoom.right == 2)
        {
            numWalls++;
        }

        if (theRoom.down == 1)
        {
            numDoors++;
        }
        else if (theRoom.down == 2)
        {
            numWalls++;
        }

        if (theRoom.left == 1)
        {
            numDoors++;
        }
        else if (theRoom.left == 2)
        {
            numWalls++;
        }

        // Check what type of room it is
        // 1 entrance and 0 walls
        if (numDoors == 1 && numWalls == 0)
        {
            theRoom = OneDoorThreeVacant(theRoom);
        }

        // 1 entrance and 1 wall
        if (numDoors == 1 && numWalls == 1)
        {
            theRoom = OneDoorOneWall(theRoom);
        }

        // 1 entrance and 2 walls
        if (numDoors == 1 && numWalls == 2)
        {
            theRoom = OneDoorTwoWalls(theRoom);
        }

        // 1 entrance and 3 walls
        if (numDoors == 1 && numWalls == 3)
        {
            theRoom = OneDoorThreeWalls(theRoom);
        }

        // 2 entrances and X walls
        if (numDoors == 2)
        {
            theRoom = TwoDoors(theRoom);
        }

        // 3 entrances and X walls
        if (numDoors == 3)
        {
            theRoom = ThreeDoors(theRoom);
        }

        // 4 entrances
        if (numDoors == 4)
        {
        }

        roomLayout[x, y] = theRoom;

        return(true);
    }
示例#5
0
    void EmbedMatrix()
    {
        // Set every room style
        for (int i = 1; i < 8; i++)
        {
            for (int j = 1; j < 8; j++)
            {
                PreRoom theRoom = roomLayout[i, j];
                int     type    = 0;
                type = Random.Range(0, 2);

                theRoom.style = 0;

                // Empty room
                if (theRoom.up != 1 && theRoom.right != 1 && theRoom.down != 1 && theRoom.left != 1)
                {
                    theRoom.style = 0;
                }

                // Treasure or Armory room with a door at the top
                if (theRoom.up == 1 && theRoom.right != 1 && theRoom.down != 1 && theRoom.left != 1)
                {
                    if (type == 0)
                    {
                        theRoom.style = 7;
                    }
                    else
                    {
                        theRoom.style = 11;
                    }
                }


                // Treasure or Armory room with a door at the right
                if (theRoom.up != 1 && theRoom.right == 1 && theRoom.down != 1 && theRoom.left != 1)
                {
                    if (type == 0)
                    {
                        theRoom.style = 8;
                    }
                    else
                    {
                        theRoom.style = 12;
                    }
                }

                // Treasure or Armory room with a door at the bottom
                if (theRoom.up != 1 && theRoom.right != 1 && theRoom.down == 1 && theRoom.left != 1)
                {
                    if (type == 0)
                    {
                        theRoom.style = 9;
                    }
                    else
                    {
                        theRoom.style = 13;
                    }
                }

                // Treasure or Armory room with a door at the left
                if (theRoom.up != 1 && theRoom.right != 1 & theRoom.down != 1 && theRoom.left == 1)
                {
                    if (type == 0)
                    {
                        theRoom.style = 10;
                    }
                    else
                    {
                        theRoom.style = 14;
                    }
                }

                // Combat room with a door at the top and the right
                if (theRoom.up == 1 && theRoom.right == 1 && theRoom.down != 1 && theRoom.left != 1)
                {
                    theRoom.style = 1;
                }

                // Combat room with a door at the top and the bottom
                if (theRoom.up == 1 && theRoom.right != 1 && theRoom.down == 1 && theRoom.left != 1)
                {
                    theRoom.style = 2;
                }

                // Combat room with a door at the top and the left
                if (theRoom.up == 1 && theRoom.right != 1 && theRoom.down != 1 && theRoom.left == 1)
                {
                    theRoom.style = 3;
                }

                // Combat room with a door at the right and the bottom
                if (theRoom.up != 1 && theRoom.right == 1 && theRoom.down == 1 && theRoom.left != 1)
                {
                    theRoom.style = 4;
                }

                // Combat room with a door at the right and the left
                if (theRoom.up != 1 && theRoom.right == 1 && theRoom.down != 1 && theRoom.left == 1)
                {
                    theRoom.style = 5;
                }

                // Combat room with a door at the bottom and the left
                if (theRoom.up != 1 && theRoom.right != 1 && theRoom.down == 1 && theRoom.left == 1)
                {
                    theRoom.style = 6;
                }

                // Combat room with a door at the top right and bottom
                if (theRoom.up == 1 && theRoom.right == 1 && theRoom.down == 1 && theRoom.left != 1)
                {
                    theRoom.style = 18;
                }

                // Combat room with a door at the right bottom and left
                if (theRoom.up != 1 && theRoom.right == 1 && theRoom.down == 1 && theRoom.left == 1)
                {
                    theRoom.style = 15;
                }

                // Combat room with a door at the bottom left and top
                if (theRoom.up == 1 && theRoom.right != 1 && theRoom.down == 1 && theRoom.left == 1)
                {
                    theRoom.style = 16;
                }

                // Combat room with a door at the left top and right
                if (theRoom.up == 1 && theRoom.right == 1 && theRoom.down != 1 && theRoom.left == 1)
                {
                    theRoom.style = 17;
                }

                // Combat room with a door at the left top and right
                if (theRoom.up == 1 && theRoom.right == 1 && theRoom.down == 1 && theRoom.left == 1)
                {
                    theRoom.style = 21;
                }


                roomLayout[i, j] = theRoom;
            }
        }

        roomLayout[4, 4].style = 19;
        roomLayout[(int)bossCoords.x, (int)bossCoords.y].style = 20;

        // Fill in the rooms

        for (int i = 0; i < 7; i++)
        {
            int refNum = i + 1;
            Row1[i] = roomLayout[refNum, 1].style;
        }

        for (int i = 0; i < 7; i++)
        {
            int refNum = i + 1;
            Row2[i] = roomLayout[refNum, 2].style;
        }

        for (int i = 0; i < 7; i++)
        {
            int refNum = i + 1;
            Row3[i] = roomLayout[refNum, 3].style;
        }

        for (int i = 0; i < 7; i++)
        {
            int refNum = i + 1;
            Row4[i] = roomLayout[refNum, 4].style;
        }

        for (int i = 0; i < 7; i++)
        {
            int refNum = i + 1;
            Row5[i] = roomLayout[refNum, 5].style;
        }

        for (int i = 0; i < 7; i++)
        {
            int refNum = i + 1;
            Row6[i] = roomLayout[refNum, 6].style;
        }

        for (int i = 0; i < 7; i++)
        {
            int refNum = i + 1;
            Row7[i] = roomLayout[refNum, 7].style;
        }
    }
示例#6
0
    void ForceValidation()
    {
        roomLayout[4, 5].down  = 1;
        roomLayout[5, 4].left  = 1;
        roomLayout[4, 3].up    = 1;
        roomLayout[3, 4].right = 1;

        roomLayout[1, 1].left = 2;
        roomLayout[1, 2].left = 2;
        roomLayout[1, 3].left = 2;
        roomLayout[1, 4].left = 2;
        roomLayout[1, 5].left = 2;
        roomLayout[1, 6].left = 2;
        roomLayout[1, 7].left = 2;

        roomLayout[7, 1].right = 2;
        roomLayout[7, 2].right = 2;
        roomLayout[7, 3].right = 2;
        roomLayout[7, 4].right = 2;
        roomLayout[7, 5].right = 2;
        roomLayout[7, 6].right = 2;
        roomLayout[7, 7].right = 2;

        roomLayout[1, 1].up = 2;
        roomLayout[2, 1].up = 2;
        roomLayout[3, 1].up = 2;
        roomLayout[4, 1].up = 2;
        roomLayout[5, 1].up = 2;
        roomLayout[6, 1].up = 2;
        roomLayout[7, 1].up = 2;

        roomLayout[1, 7].down = 2;
        roomLayout[2, 7].down = 2;
        roomLayout[3, 7].down = 2;
        roomLayout[4, 7].down = 2;
        roomLayout[5, 7].down = 2;
        roomLayout[6, 7].down = 2;
        roomLayout[7, 7].down = 2;


        for (int i = 1; i < 8; i++)
        {
            for (int j = 1; j < 8; j++)
            {
                PreRoom theRoom = roomLayout[i, j];

                if (theRoom.up == 1)
                {
                    int y = j + 1;
                    roomLayout[i, y].down = 1;
                }

                if (theRoom.right == 1)
                {
                    int x = i + 1;
                    roomLayout[x, j].left = 1;
                }

                if (theRoom.down == 1)
                {
                    int y = j - 1;
                    roomLayout[i, y].up = 1;
                }

                if (theRoom.left == 1)
                {
                    int x = i - 1;
                    roomLayout[x, j].right = 1;
                }
            }
        }

        Vector2 dungeonPos = bossCoords;
        Vector2 cullRooms  = bossCoords;

        // Make sure no rooms point towards the boss room
        cullRooms.x += 1;
        roomLayout[(int)cullRooms.x, (int)cullRooms.y].left = 0;
        cullRooms.x -= 2;
        roomLayout[(int)cullRooms.x, (int)cullRooms.y].right = 0;

        cullRooms.x += 1;
        cullRooms.y += 1;
        roomLayout[(int)cullRooms.x, (int)cullRooms.y].down = 0;

        dungeonPos.y -= 1;

        bool dungY = false;
        bool dungX = false;

        while (dungX == false)
        {
            if (dungeonPos.x != 4)
            {
                if (dungeonPos.x < 4)
                {
                    roomLayout[(int)dungeonPos.x, (int)dungeonPos.y].right = 1;
                    dungeonPos.x += 1;
                    roomLayout[(int)dungeonPos.x, (int)dungeonPos.y].left = 1;
                }

                if (dungeonPos.x > 4)
                {
                    roomLayout[(int)dungeonPos.x, (int)dungeonPos.y].left = 1;
                    dungeonPos.x -= 1;
                    roomLayout[(int)dungeonPos.x, (int)dungeonPos.y].right = 1;
                }
            }
            else
            {
                dungX = true;
            }
        }

        while (dungY == false)
        {
            if (dungeonPos.y != 4)
            {
                if (dungeonPos.y < 4)
                {
                    roomLayout[(int)dungeonPos.x, (int)dungeonPos.y].up = 1;
                    dungeonPos.y += 1;
                    roomLayout[(int)dungeonPos.x, (int)dungeonPos.y].down = 1;
                }

                if (dungeonPos.y > 4)
                {
                    roomLayout[(int)dungeonPos.x, (int)dungeonPos.y].down = 1;
                    dungeonPos.y -= 1;
                    roomLayout[(int)dungeonPos.x, (int)dungeonPos.y].up = 1;
                }
            }
            else
            {
                dungY = true;
            }
        }
    }
示例#7
0
    PreRoom ThreeDoors(PreRoom _theRoom)
    {
        PreRoom theRoom = _theRoom;
        Vector2 otherPos;

        bool setTop   = true;
        bool setRight = true;
        bool setDown  = true;
        bool setLeft  = true;

        if (theRoom.up == 1)
        {
            setTop = false;
        }

        if (theRoom.right == 1)
        {
            setRight = false;
        }

        if (theRoom.down == 1)
        {
            setDown = false;
        }

        if (theRoom.left == 1)
        {
            setLeft = false;
        }

        if (setTop)
        {
            if (theRoom.up != 2)
            {
                // Set room to the top
                otherPos    = theRoom.pos;
                otherPos.y += 1;

                theRoom.up = 2;
                roomLayout[(int)otherPos.x, (int)otherPos.y].down = 2;
            }
        }

        if (setRight)
        {
            if (theRoom.right != 2)
            {
                // Set room to the top
                otherPos    = theRoom.pos;
                otherPos.x += 1;

                theRoom.right = 2;
                roomLayout[(int)otherPos.x, (int)otherPos.y].left = 2;
            }
        }

        if (setDown)
        {
            if (theRoom.down != 2)
            {
                // Set room to the top
                otherPos    = theRoom.pos;
                otherPos.y -= 1;

                theRoom.down = 2;
                roomLayout[(int)otherPos.x, (int)otherPos.y].up = 2;
            }
        }

        if (setLeft)
        {
            if (theRoom.left != 2)
            {
                // Set room to the top
                otherPos    = theRoom.pos;
                otherPos.x -= 1;

                theRoom.left = 2;
                roomLayout[(int)otherPos.x, (int)otherPos.y].right = 2;
            }
        }

        theRoom.roomState = 2;

        return(_theRoom);
    }
示例#8
0
    PreRoom OneDoorTwoWalls(PreRoom _theRoom)
    {
        PreRoom theRoom = _theRoom;
        Vector2 otherPos;

        bool setTop   = true;
        bool setRight = true;
        bool setDown  = true;
        bool setLeft  = true;

        if (theRoom.up != 0)
        {
            setTop = false;
        }

        if (theRoom.right != 0)
        {
            setRight = false;
        }

        if (theRoom.down != 0)
        {
            setDown = false;
        }

        if (theRoom.left != 0)
        {
            setLeft = false;
        }

        if (setTop)
        {
            // Set room to the top
            otherPos    = theRoom.pos;
            otherPos.y += 1;

            theRoom.up = 1;
            roomLayout[(int)otherPos.x, (int)otherPos.y].down      = 1;
            roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
        }

        if (setRight)
        {
            // Set room to the right
            otherPos    = theRoom.pos;
            otherPos.x += 1;

            theRoom.right = 1;
            roomLayout[(int)otherPos.x, (int)otherPos.y].left      = 1;
            roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
        }

        if (setDown)
        {
            // Set room to the bottom
            otherPos    = theRoom.pos;
            otherPos.y -= 1;

            theRoom.down = 1;
            roomLayout[(int)otherPos.x, (int)otherPos.y].up        = 1;
            roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
        }

        if (setLeft)
        {
            // Set room to the top
            otherPos    = theRoom.pos;
            otherPos.x -= 1;

            theRoom.left = 1;
            roomLayout[(int)otherPos.x, (int)otherPos.y].right     = 1;
            roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
        }

        theRoom.roomState = 2;

        return(theRoom);
    }
示例#9
0
    PreRoom OneDoorTwoWalls(PreRoom _theRoom)
    {
        PreRoom theRoom = _theRoom;
        Vector2 otherPos;

        bool setTop = true;
        bool setRight = true;
        bool setDown = true;
        bool setLeft = true;

        if (theRoom.up != 0)
            setTop = false;

        if (theRoom.right != 0)
            setRight = false;

        if (theRoom.down != 0)
            setDown = false;

        if (theRoom.left != 0)
            setLeft = false;

        if (setTop)
        {
            // Set room to the top
            otherPos = theRoom.pos;
            otherPos.y += 1;

            theRoom.up = 1;
            roomLayout[(int)otherPos.x, (int)otherPos.y].down = 1;
            roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
        }

        if (setRight)
        {
            // Set room to the right
            otherPos = theRoom.pos;
            otherPos.x += 1;

            theRoom.right = 1;
            roomLayout[(int)otherPos.x, (int)otherPos.y].left = 1;
            roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
        }

        if (setDown)
        {
            // Set room to the bottom
            otherPos = theRoom.pos;
            otherPos.y -= 1;

            theRoom.down = 1;
            roomLayout[(int)otherPos.x, (int)otherPos.y].up = 1;
            roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
        }

        if (setLeft)
        {
            // Set room to the top
            otherPos = theRoom.pos;
            otherPos.x -= 1;

            theRoom.left = 1;
            roomLayout[(int)otherPos.x, (int)otherPos.y].right = 1;
            roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
        }

        theRoom.roomState = 2;

        return theRoom;
    }
示例#10
0
    PreRoom OneDoorThreeWalls(PreRoom _theRoom)
    {
        PreRoom theRoom = _theRoom;

        // We done bruh
        theRoom.roomState = 2;

        return theRoom;
    }
示例#11
0
    PreRoom OneDoorThreeVacant(PreRoom _theRoom)
    {
        PreRoom theRoom = _theRoom;
        int vacant = Random.Range(0, 3);
        Vector2 otherPos;

        bool setTop = true;
        bool setRight = true;
        bool setDown = true;
        bool setLeft = true;

        bool up = false;
        bool right = false;
        bool down = false;
        bool left = false;

        if (theRoom.up == 1)
            up = true;

        if (theRoom.right == 1)
            right = true;

        if (theRoom.down == 1)
            down = true;

        if (theRoom.left == 1)
            left = true;

        if (up)
        {
            setTop = false;
            if (vacant == 0)
            {
                theRoom.right = 2;
                theRoom.down = 1;
                theRoom.left = 1;
            }
            else if (vacant == 1)
            {
                theRoom.right = 1;
                theRoom.down = 2;
                theRoom.left = 1;
            }
            else if (vacant == 2)
            {
                theRoom.right = 1;
                theRoom.down = 1;
                theRoom.left = 2;
            }
        }

        if (right)
        {
            setRight = false;
            if (vacant == 0)
            {
                theRoom.up = 2;
                theRoom.down = 1;
                theRoom.left = 1;
            }
            else if (vacant == 1)
            {
                theRoom.up = 1;
                theRoom.down = 2;
                theRoom.left = 1;
            }
            else if (vacant == 2)
            {
                theRoom.up = 1;
                theRoom.down = 1;
                theRoom.left = 2;
            }
        }

        if (down)
        {
            setDown = false;
            if (vacant == 0)
            {
                theRoom.up = 2;
                theRoom.right = 1;
                theRoom.left = 1;
            }
            else if (vacant == 1)
            {
                theRoom.up = 1;
                theRoom.right = 2;
                theRoom.left = 1;
            }
            else if (vacant == 2)
            {
                theRoom.up = 1;
                theRoom.right = 1;
                theRoom.left = 2;
            }
        }

        if (left)
        {
            setLeft = false;
            if (vacant == 0)
            {
                theRoom.up = 2;
                theRoom.right = 1;
                theRoom.down = 1;
            }
            else if (vacant == 1)
            {
                theRoom.up = 1;
                theRoom.right = 2;
                theRoom.down = 1;
            }
            else if (vacant == 2)
            {
                theRoom.up = 1;
                theRoom.right = 1;
                theRoom.down = 2;
            }
        }

        if (setTop)
        {
            // Set room to the top
            otherPos = theRoom.pos;
            otherPos.y += 1;
            if (theRoom.up == 1)
            {
                roomLayout[(int)otherPos.x, (int)otherPos.y].down = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
            }
            else if (theRoom.up == 2)
            {
                roomLayout[(int)otherPos.x, (int)otherPos.y].down = 2;
            }

            theRoom.roomState = 2;
        }

        if (setRight)
        {
            // Set room to the right
            otherPos = theRoom.pos;
            otherPos.x += 1;
            if (theRoom.right == 1)
            {
                roomLayout[(int)otherPos.x, (int)otherPos.y].left = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
            }
            else if (theRoom.right == 2)
            {
                roomLayout[(int)otherPos.x, (int)otherPos.y].left = 2;
            }

            theRoom.roomState = 2;
        }

        if (setDown)
        {
            // Set room to the bottom
            otherPos = theRoom.pos;
            otherPos.y -= 1;
            if (theRoom.down == 1)
            {
                roomLayout[(int)otherPos.x, (int)otherPos.y].up = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
            }
            else if (theRoom.down == 2)
            {
                roomLayout[(int)otherPos.x, (int)otherPos.y].up = 2;
            }

            theRoom.roomState = 2;
        }

        if (setLeft)
        {
            // Set room to the left
            otherPos = theRoom.pos;
            otherPos.x -= 1;
            if (theRoom.left == 1)
            {
                roomLayout[(int)otherPos.x, (int)otherPos.y].left = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
            }
            else if (theRoom.down == 2)
            {
                roomLayout[(int)otherPos.x, (int)otherPos.y].left = 2;
            }

            theRoom.roomState = 2;
        }

        return theRoom;
    }
示例#12
0
    PreRoom OneDoorOneWall(PreRoom _theRoom)
    {
        PreRoom theRoom = _theRoom;
        Vector2 otherPos;

        bool setTop = true;
        bool setRight = true;
        bool setDown = true;
        bool setLeft = true;

        if (theRoom.up != 0)
            setTop = false;

        if (theRoom.right != 0)
            setRight = false;

        if (theRoom.down != 0)
            setDown = false;

        if (theRoom.left != 0)
            setLeft = false;

        bool randCheck = true;
        int randVal = 0;

        if (setTop)
        {
            // Set room to the top
            otherPos = theRoom.pos;
            otherPos.y += 1;

            // See if we place a door or a wall
            if (randCheck)
                randVal = Random.Range(0, 2);

            if (randVal == 0)
                randCheck = false;

            if (randCheck)
            {
                theRoom.up = 2;
                roomLayout[(int)otherPos.x, (int)otherPos.y].down = 2;
            }
            else
            {
                theRoom.up = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].down = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
            }

            randCheck = true;

        }

        if (setRight)
        {
            // Set room to the top
            otherPos = theRoom.pos;
            otherPos.x += 1;

            // See if we place a door or a wall
            if (randCheck)
                randVal = Random.Range(0, 2);

            if (randVal == 0)
                randCheck = false;

            if (randCheck)
            {
                theRoom.right = 2;
                roomLayout[(int)otherPos.x, (int)otherPos.y].left = 2;
            }
            else
            {
                theRoom.right = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].left = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
            }

            randCheck = true;

        }

        if (setDown)
        {
            // Set room to the top
            otherPos = theRoom.pos;
            otherPos.y -= 1;

            // See if we place a door or a wall
            if (randCheck)
                randVal = Random.Range(0, 2);

            if (randVal == 0)
                randCheck = false;

            if (randCheck)
            {
                theRoom.down = 2;
                roomLayout[(int)otherPos.x, (int)otherPos.y].up = 2;
            }
            else
            {
                theRoom.down = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].up = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
            }

            randCheck = true;

        }

        if (setLeft)
        {
            // Set room to the top
            otherPos = theRoom.pos;
            otherPos.x -= 1;

            // See if we place a door or a wall
            if (randCheck)
                randVal = Random.Range(0, 2);

            if (randVal == 0)
                randCheck = false;

            if (randCheck)
            {
                theRoom.left = 2;
                roomLayout[(int)otherPos.x, (int)otherPos.y].right = 2;
            }
            else
            {
                theRoom.left = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].right = 1;
                roomLayout[(int)otherPos.x, (int)otherPos.y].roomState = 1;
            }

            randCheck = true;

        }

        theRoom.roomState = 2;

        return theRoom;
    }
示例#13
0
    PreRoom TwoDoors(PreRoom _theRoom)
    {
        PreRoom theRoom = _theRoom;
        Vector2 otherPos;

        bool setTop = true;
        bool setRight = true;
        bool setDown = true;
        bool setLeft = true;

        if (theRoom.up == 0)
            setTop = false;

        if (theRoom.right == 0)
            setRight = false;

        if (theRoom.down == 0)
            setDown = false;

        if (theRoom.left == 0)
            setLeft = false;

        if (setTop)
        {
            // Set room to the top
            otherPos = theRoom.pos;
            otherPos.y += 1;

            theRoom.up = 2;
            roomLayout[(int)otherPos.x, (int)otherPos.y].down = 2;
        }

        if (setRight)
        {
            // Set room to the top
            otherPos = theRoom.pos;
            otherPos.x += 1;

            theRoom.right = 2;
            roomLayout[(int)otherPos.x, (int)otherPos.y].left = 2;
        }

        if (setDown)
        {
            // Set room to the top
            otherPos = theRoom.pos;
            otherPos.y -= 1;

            theRoom.down = 2;
            roomLayout[(int)otherPos.x, (int)otherPos.y].up = 2;
        }

        if (setLeft)
        {
            // Set room to the top
            otherPos = theRoom.pos;
            otherPos.x -= 1;

            theRoom.left = 2;
            roomLayout[(int)otherPos.x, (int)otherPos.y].right = 2;
        }

        theRoom.roomState = 2;

        return _theRoom;
    }