コード例 #1
0
        /// <summary>
        /// Generates all the cubes in the corridor.
        /// </summary>
        /// <param name="width">Width (floor coordinates) of corridor.</param>
        /// <param name="depth">Depth (floor coordinates) of corridor.</param>
        /// <param name="height">Height (floor to ceiling) of corridor.</param>
        public LRCorridorCubes(int width, int depth, int height)
        {
            UpWall = new StandardWallCubes(width, height, depth / 2, 1);
            DownWall = new StandardWallCubes(width, height, depth / 2, 1);

            Width = width;
            Height = height;
            Depth = depth;
        }
コード例 #2
0
        /// <summary>
        /// Creates a fully rendered instance of cubes for a Corridor.
        /// </summary>
        /// <param name="width">Width (floor coordinates) of corridor.</param>
        /// <param name="depth">Depth (floor coordinates) of corridor.</param>
        /// <param name="height">Height (floor to ceiling) of corridor.</param>
        public UDCorridorCubes(int width, int depth, int height)
        {
            LeftWall = new StandardWallCubes(depth, height, width / 2, 1);
            RightWall = new StandardWallCubes(depth, height, width / 2, 1);

            Width = width;
            Height = height;
            Depth = depth;
        }
コード例 #3
0
        /// <summary>
        /// Generates cubes along our wall with a door in it.
        /// </summary>
        /// <param name="width">Width (floor coordinates) of the wall</param>
        /// <param name="height">Height (floor to ceiling) of the wall</param>
        /// <param name="maxDepth">Maximum depth the wall can poke out</param>
        /// <param name="minDepth">Minimum depth the wall can poke out</param>
        /// <param name="doorCode">Direction the door is facing</param>
        /// <param name="neighborCubes">Reference to the RoomCubes structure of the neighbor
        /// connected by this door.</param>
        public DoorWallCubes(int width, int height, int maxDepth, int minDepth,
		                     int doorCode, RoomCubes neighborCubes)
        {
            DoorCode = doorCode;
            int lWidth = (width - RogueDungeon.CORRIDOR_WIDTH) / 2;
            int rWidth = width - lWidth - RogueDungeon.CORRIDOR_WIDTH;

            R_Side = new StandardWallCubes(rWidth, height, maxDepth, minDepth);
            L_Side = new StandardWallCubes(lWidth, height, maxDepth, minDepth);

            // We need to know which type of Corridor Cubes to extract - use door code for that!
            if (doorCode == RogueRoom.LEFT_DOOR_MASK)
            {
                LRCorridorCubes corCubes = (LRCorridorCubes)neighborCubes;
                L_Corner = new OutsideCornerCubes(corCubes.DownWall.MaxDepth, L_Side.MaxDepth,
                                                  L_Side.GetRightEdge(), corCubes.DownWall.GetRightEdge());
                R_Corner = new OutsideCornerCubes(R_Side.MaxDepth, corCubes.UpWall.MaxDepth,
                                                  corCubes.UpWall.GetRightEdge(), R_Side.GetLeftEdge());
            }
            else if (doorCode == RogueRoom.RIGHT_DOOR_MASK)
            {
                LRCorridorCubes corCubes = (LRCorridorCubes)neighborCubes;
                L_Corner = new OutsideCornerCubes(corCubes.UpWall.MaxDepth, L_Side.MaxDepth,
                                                  L_Side.GetRightEdge(), corCubes.UpWall.GetLeftEdge());
                R_Corner = new OutsideCornerCubes(R_Side.MaxDepth, corCubes.DownWall.MaxDepth,
                                                  corCubes.DownWall.GetLeftEdge(), R_Side.GetLeftEdge());
            }
            else if (doorCode == RogueRoom.UP_DOOR_MASK)
            {
                UDCorridorCubes corCubes = (UDCorridorCubes)neighborCubes;
                L_Corner = new OutsideCornerCubes(corCubes.LeftWall.MaxDepth, L_Side.MaxDepth,
                                                  L_Side.GetRightEdge(), corCubes.LeftWall.GetRightEdge());
                R_Corner = new OutsideCornerCubes(R_Side.MaxDepth, corCubes.RightWall.MaxDepth,
                                                  corCubes.RightWall.GetRightEdge(), R_Side.GetLeftEdge());
            }
            else if (doorCode == RogueRoom.DOWN_DOOR_MASK)
            {
                UDCorridorCubes corCubes = (UDCorridorCubes)neighborCubes;
                L_Corner = new OutsideCornerCubes(corCubes.RightWall.MaxDepth, L_Side.MaxDepth,
                                                  L_Side.GetRightEdge(), corCubes.RightWall.GetLeftEdge());
                R_Corner = new OutsideCornerCubes(R_Side.MaxDepth, corCubes.LeftWall.MaxDepth,
                                                  corCubes.LeftWall.GetLeftEdge(), R_Side.GetLeftEdge());
            }
            else // ERROR!
            {
                throw new ArgumentException("Door code doesn't work D:");
            }
        }