public void SetupCorridor(Direction4D direction, byte length, System.Random rand)
    {
        GameObject cor = new GameObject();

        Corridor corridor = cor.AddComponent <Corridor>();

        Vector2 startCorner = Vector2.zero;
        Vector2 endCorner   = Vector2.zero;

        int offsetW = SimpleFunctions.Min(width, prevRoom.width);
        int offsetH = SimpleFunctions.Min(height, prevRoom.height);

        int tempX = rand.Next(2, offsetW);
        int tempY = rand.Next(1, offsetH);

        switch (direction)
        {
        case Direction4D.Up:
            startCorner = new Vector2(start.x + tempX, end.y);
            endCorner   = new Vector2(startCorner.x, startCorner.y + length);
            break;

        case Direction4D.Down:
            startCorner = new Vector2(start.x + tempX, start.y);
            endCorner   = new Vector2(startCorner.x, startCorner.y - length);
            break;

        case Direction4D.Right:
            startCorner = new Vector2(end.x, start.y + tempY);
            endCorner   = new Vector2(startCorner.x + length, startCorner.y);
            break;

        case Direction4D.Left:
            startCorner = new Vector2(start.x, start.y + tempY);
            endCorner   = new Vector2(startCorner.x - length, startCorner.y);
            break;
        }

        corridor.Setup(startCorner, endCorner, this, prevRoom, direction);
    }