public string GenerateFactionName()
    {
        const string startSymbol = "#origin#";

        try
        {
            //var grammar = new TraceryNet.Grammar(new FileInfo(_fullPath));

            var grammar = new TraceryNet.Grammar(FactionNames.text);

            var factionName = grammar.Flatten(startSymbol);

            while (WorldData.Instance.Factions.ContainsKey(factionName))
            {
                factionName = grammar.Flatten(startSymbol);
            }

            return(factionName);
        }
        catch (Exception e)
        {
            Debug.Log("Error opening " + _fullPath + "! " + e);
            throw;
        }
    }
Beispiel #2
0
 private static string GenerateText(TextAsset file)
 {
     try
     {
         var grammar = new TraceryNet.Grammar(file.ToString());
         return(grammar.Flatten(StartSymbol));
     }
     catch (Exception e)
     {
         Debug.Log("Error opening " + file + "! " + e);
         throw;
     }
 }
Beispiel #3
0
    private static string GenerateText(string file)
    {
        var basePath = Environment.CurrentDirectory;

        var fullPath = Path.Combine(basePath, StoryPath.TrimStart('\\', '/'), file);

        fullPath = Path.Combine(StoryPath, fullPath);

        try
        {
            var grammar = new TraceryNet.Grammar(new FileInfo(fullPath));
            return(grammar.Flatten(StartSymbol));
        }
        catch (Exception e)
        {
            Debug.Log("Error opening " + file + "! " + e);
            throw;
        }
    }