void GenerateRandomNames() { Text text = GameObject.Find("Text").GetComponent<Text>(); text.text = ""; string path = "Assets/Scripts/Utils/ProceduralNames/Data/Names/"; ProceduralNameGenerator maleNames = new ProceduralNameGenerator(path + "Male.txt"); ProceduralNameGenerator femaleNames = new ProceduralNameGenerator(path + "Female.txt"); ProceduralNameGenerator ukranianNames = new ProceduralNameGenerator(path + "Ukranian.txt"); int max = 8; for (int i = 0; i < max; i++) { string word = maleNames.GenerateRandomWord(Random.Range(3, 7)); text.text += word + "\n"; } text.text += "\n"; for (int i = 0; i < max; i++) { string word = femaleNames.GenerateRandomWord(Random.Range(3, 7)); text.text += word + "\n"; } text.text += "\n"; for (int i = 0; i < max; i++) { string word = ukranianNames.GenerateRandomWord(Random.Range(3, 7)); text.text += word + "\n"; } }
static void Main(string[] args) { ProceduralNameGenerator names = new ProceduralNameGenerator("ukrainian_names.txt"); for (int i = 0; i < 16; i++) { string word = names.GenerateRandomWord(7); Console.WriteLine(word); } }
static void Main(string[] args) { ProceduralNameGenerator names = new ProceduralNameGenerator("ukrainian_names.txt"); for (int i = 0; i < 16; i++) { string word = names.GenerateRandomWord(7); Console.WriteLine(word); } }
void Setup() { ProceduralNameGenerator names = new ProceduralNameGenerator(words); //numChars = Random.Range(2, 4); numChars = 3; for (int i = 0; i < numChars; ++i) { Vector3 spawnPoint; if (numChars < 3) { spawnPoint = spawnPoint1.GetChild(i).transform.position; } else { spawnPoint = spawnPoint2.GetChild(i).transform.position; } GameObject npcObj = Instantiate(Services.Prefabs.NPC, spawnPoint, Quaternion.identity, this.transform) as GameObject; int spriteRand = Random.Range(0, sprites.Count); npcObj.GetComponent <SpriteRenderer>().sprite = sprites[spriteRand]; sprites.RemoveAt(spriteRand); npcObj.GetComponent <NPC>().InitializeNPC(names.GenerateRandomWord(5)); npcs.Add(npcObj.GetComponent <NPC>()); } for (int j = 0; j < numChars; ++j) { List <NPC> npcPrep = new List <NPC>(); NPC.Relationship[] relationshipPrep = new NPC.Relationship[numChars - 1]; for (int k = 0; k < numChars; ++k) { if (k != j) { npcPrep.Add(npcs[k]); } } for (int l = 0; l < numChars - 1; ++l) { relationshipPrep[l] = relationshipStates[Random.Range(0, relationshipStates.Length)]; } npcs[j].SetRelationships(npcPrep, relationshipPrep); } }
void GenerateRandomNames() { Text text = GameObject.Find("Text").GetComponent <Text>(); text.text = ""; string path = "Assets/Scripts/Utils/ProceduralNames/Data/Names/"; ProceduralNameGenerator maleNames = new ProceduralNameGenerator(path + "Male.txt"); ProceduralNameGenerator femaleNames = new ProceduralNameGenerator(path + "Female.txt"); ProceduralNameGenerator ukranianNames = new ProceduralNameGenerator(path + "Ukranian.txt"); int max = 8; for (int i = 0; i < max; i++) { string word = maleNames.GenerateRandomWord(Random.Range(3, 7)); text.text += word + "\n"; } text.text += "\n"; for (int i = 0; i < max; i++) { string word = femaleNames.GenerateRandomWord(Random.Range(3, 7)); text.text += word + "\n"; } text.text += "\n"; for (int i = 0; i < max; i++) { string word = ukranianNames.GenerateRandomWord(Random.Range(3, 7)); text.text += word + "\n"; } }