Ejemplo n.º 1
0
    private void CreateRooms(List <MazeNode> rooms, List <MazeNode> emptyCells, int roomCount)
    {
        int levelDifficulty = currentLevel - 1;

        for (int i = 0; i < roomCount; i++)
        {
            int      newRoomIndex = Random.Range(0, emptyCells.Count);
            MazeNode newRoom      = emptyCells[newRoomIndex];
            emptyCells.RemoveAt(newRoomIndex);
            rooms.Add(newRoom);
            newRoom.CType      = MazeNode.CellType.Room;
            newRoom.Difficulty = BASE_DIFFICULTY + (levelDifficulty * 2);
            newRoom.JoinAdjacentRooms();
        }

        MazeNode startNode = rooms[0];

        startNode.Difficulty = BASE_DIFFICULTY + levelDifficulty;
        startNode.RType      = MazeNode.RoomType.LevelStart;
        MazeNode lastRoom = getFarthestRoom(rooms[0], rooms);

        lastRoom.RType      = MazeNode.RoomType.LastRoom;
        lastRoom.Difficulty = BASE_DIFFICULTY + (levelDifficulty * 3);
    }
Ejemplo n.º 2
0
 private void CreateTunnel(MazeNode newTunnelCell)
 {
     newTunnelCell.CType = MazeNode.CellType.Tunnel;
     newTunnelCell.JoinAdjacentRooms();
 }