protected void AddRoom(ref Vector2 currentPosition, Direction direction, ref DungeonMetadata.RoomInfo currentRoom, ref Layout layout, DungeonMetadata.RoomInfo.RoomType roomType = DungeonMetadata.RoomInfo.RoomType.Normal)
        {
            currentPosition         = Move(direction, currentPosition);
            layout[currentPosition] = true;
            var newRoom = new DungeonMetadata.RoomInfo(currentPosition, roomType);

            currentRoom.ConnectedRooms.Add(newRoom);
            newRoom.ConnectedRooms.Add(currentRoom);
            currentRoom = newRoom;
        }
Esempio n. 2
0
        public void SetUpWall(DungeonMetadata.RoomInfo info)
        {
            for (int i = 0; i < info.ConnectedRooms.Count; i++)
            {
                int index = (int)GetDirection(info, info.ConnectedRooms[i]);

                _wallList[index].SetActive(false);
                _doorsList[index].SetActive(true);
            }
        }
        private void GenerateRoomList(DungeonMetadata.RoomInfo startRoom, List <DungeonMetadata.RoomInfo> roomList)
        {
            roomList.Add(startRoom);

            for (int i = 0; i < startRoom.ConnectedRooms.Count; i++)
            {
                if (!roomList.Contains(startRoom.ConnectedRooms[i]))
                {
                    GenerateRoomList(startRoom.ConnectedRooms[i], roomList);
                }
            }
        }
Esempio n. 4
0
        private GenerateLayoutPhase.Direction GetDirection(DungeonMetadata.RoomInfo info, DungeonMetadata.RoomInfo neighborInfo)
        {
            if (info.Position.x > neighborInfo.Position.x)
            {
                return(GenerateLayoutPhase.Direction.Down);
            }
            if (info.Position.x < neighborInfo.Position.x)
            {
                return(GenerateLayoutPhase.Direction.Up);
            }
            if (info.Position.y < neighborInfo.Position.y)
            {
                return(GenerateLayoutPhase.Direction.Right);
            }
            if (info.Position.y > neighborInfo.Position.y)
            {
                return(GenerateLayoutPhase.Direction.Left);
            }

            return(GenerateLayoutPhase.Direction.Down);
        }