private static string _generateNameHelper(List <NamePart> nameParts, Randomizer randomizer) { List <BuildableNamePart> bnpList = new List <BuildableNamePart>(); int nameLength = 0; for (int i = 0; i < nameParts.Count; i++) { NamePart part = nameParts[i]; bool buildableIsOptional = false; if (part.isOptional) { if (randomizer.Int32(10) > 5) { continue; } buildableIsOptional = true; } string newWord = part.nameList[randomizer.Int32((uint)part.nameList.Count)]; if (!newWord.Trim().Equals("")) { newWord += " "; } BuildableNamePart bnp = new BuildableNamePart(buildableIsOptional, newWord); bnpList.Add(bnp); nameLength += newWord.Length; } return(_bestFitName(bnpList, nameLength)); }
private static string _generateNameHelper(List<NamePart> nameParts, Randomizer randomizer) { List<BuildableNamePart>bnpList = new List<BuildableNamePart>(); int nameLength = 0; for (int i = 0; i < nameParts.Count; i++) { NamePart part = nameParts[i]; bool buildableIsOptional = false; if(part.isOptional) { if (randomizer.Int32(10) > 5) { continue; } buildableIsOptional = true; } string newWord = part.nameList[randomizer.Int32((uint)part.nameList.Count)]; if (! newWord.Trim().Equals("")) { newWord += " "; } BuildableNamePart bnp = new BuildableNamePart(buildableIsOptional, newWord); bnpList.Add(bnp); nameLength += newWord.Length; } return _bestFitName(bnpList, nameLength); }