Пример #1
0
        /// <summary>
        /// Creates Hallways in the hotel at the right locations using the dimensions of rooms
        /// </summary>
        private void CreateHalls()
        {
            iRoom2 = new List <IRoom>();
            foreach (IRoom room in iRoom)
            {
                for (int i = room.Dimension.X; i > 0; i--)
                {
                    for (int j = room.Dimension.Y; j > 0; j--)
                    {
                        if (i != 1 || j != 1)
                        {
                            dynamic hall = new ExpandoObject();
                            hall.AreaType = "Hall";
                            hall.Position = ((i + room.Position.X - 1) + ", " + (j + room.Position.Y - 1));
                            iRoom2.Add(RFactory.CreateRoom(hall));
                        }
                    }
                }
            }

            foreach (IRoom room in iRoom2)
            {
                iRoom.Add(room);
            }
        }
Пример #2
0
        /// <summary>
        /// adds the lobby, Lift and Stairs to iRoom
        /// </summary>
        private void AddLiftAndStairs()
        {
            int     x    = GetMaxX();
            int     y    = GetMaxY();
            dynamic room = new ExpandoObject();

            for (int i = 0; i < y; i++)
            {
                room.AreaType = "Elevator";
                room.Position = i;
                IRoom elevator = RFactory.CreateRoom(room);
                iRoom.Add(elevator);

                room.AreaType = "Stairs";
                room.Position = ((x + 1) + ", " + i);
                IRoom stairs = RFactory.CreateRoom(room);
                iRoom.Add(stairs);
            }
            room.AreaType  = "Lobby";
            room.Dimension = x;
            IRoom lobby = RFactory.CreateRoom(room);

            iRoom.Add(lobby);
        }