FantasyNameGenerator.cs 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. using UnityEngine;
  2. using System.Collections.Generic;
  3. public static class FantasyNameGenerator
  4. {
  5. // Town name components
  6. private static readonly string[] townPrefixes = {
  7. "North", "South", "East", "West", "Upper", "Lower", "Old", "New", "High", "Deep",
  8. "Iron", "Gold", "Silver", "Stone", "Wood", "Green", "Red", "White", "Black", "Blue",
  9. "Dragon", "Eagle", "Wolf", "Bear", "Lion", "Oak", "Pine", "Ash", "Elm", "Willow",
  10. "Storm", "Wind", "Sun", "Moon", "Star", "Shadow", "Light", "Dark", "Bright", "Swift"
  11. };
  12. private static readonly string[] townSuffixes = {
  13. "haven", "ford", "bridge", "gate", "hill", "dale", "vale", "moor", "field", "wood",
  14. "burg", "ton", "ham", "wick", "thorpe", "by", "stead", "hurst", "marsh", "brook",
  15. "glen", "ridge", "peak", "crest", "hollow", "bend", "crossing", "falls", "rapids", "port",
  16. "watch", "guard", "hold", "keep", "tower", "wall", "stone", "rock", "cliff", "shore"
  17. };
  18. // Village name components (smaller, more rural)
  19. private static readonly string[] villagePrefixes = {
  20. "Little", "Small", "Quiet", "Peaceful", "Hidden", "Lost", "Forgotten", "Ancient", "Humble", "Simple",
  21. "Moss", "Fern", "Ivy", "Rose", "Lily", "Daisy", "Thistle", "Heather", "Sage", "Mint",
  22. "Rabbit", "Fox", "Deer", "Sheep", "Goat", "Duck", "Goose", "Crow", "Sparrow", "Robin",
  23. "Brook", "Creek", "Stream", "Pond", "Spring", "Well", "Mill", "Farm", "Orchard", "Garden"
  24. };
  25. private static readonly string[] villageSuffixes = {
  26. "hollow", "grove", "glen", "meadow", "vale", "dell", "nook", "corner", "bend", "twist",
  27. "green", "common", "field", "yard", "patch", "plot", "clearing", "glade", "thicket", "copse",
  28. "end", "side", "edge", "rim", "foot", "base", "rest", "peace", "quiet", "still"
  29. };
  30. // Forest name components
  31. private static readonly string[] forestPrefixes = {
  32. "Ancient", "Dark", "Deep", "Wild", "Mystic", "Enchanted", "Whispering", "Silent", "Sacred", "Forbidden",
  33. "Elder", "Old", "Primeval", "Twisted", "Tangled", "Dense", "Thick", "Shadowy", "Moonlit", "Sunlit",
  34. "Emerald", "Verdant", "Lush", "Green", "Golden", "Amber", "Crimson", "Silver", "Misty", "Foggy"
  35. };
  36. private static readonly string[] forestSuffixes = {
  37. "Wood", "Woods", "Forest", "Grove", "Thicket", "Copse", "Brake", "Weald", "Wildwood", "Greenwood",
  38. "Timberland", "Woodland", "Glade", "Dell", "Hollow", "Vale", "Glen", "Chase", "Park", "Reserve"
  39. };
  40. // Water body name components
  41. private static readonly string[] waterPrefixes = {
  42. "Crystal", "Clear", "Deep", "Blue", "Azure", "Sapphire", "Emerald", "Silver", "Golden", "Mirror",
  43. "Calm", "Still", "Peaceful", "Serene", "Tranquil", "Misty", "Foggy", "Hidden", "Secret", "Lost",
  44. "Dragon", "Serpent", "Swan", "Eagle", "Raven", "Heron", "Crane", "Trout", "Salmon", "Pike"
  45. };
  46. private static readonly string[] lakeSuffixes = {
  47. "Lake", "Pond", "Pool", "Mere", "Tarn", "Loch", "Water", "Waters", "Basin", "Reservoir"
  48. };
  49. private static readonly string[] oceanSuffixes = {
  50. "Sea", "Ocean", "Bay", "Gulf", "Sound", "Strait", "Channel", "Depths", "Expanse", "Waters"
  51. };
  52. // Male character name components
  53. private static readonly string[] maleFirstNames = {
  54. "Aedric", "Aldwin", "Baelor", "Cedric", "Dorian", "Edmund", "Gareth", "Henrik", "Ivar", "Jasper",
  55. "Kieran", "Leoric", "Magnus", "Nolan", "Osric", "Percival", "Quinton", "Roderick", "Soren", "Theron",
  56. "Ulric", "Victor", "Willem", "Xavier", "Yorick", "Zander", "Alaric", "Bastian", "Caspian", "Darius",
  57. "Elias", "Felix", "Gideon", "Hadrian", "Ivan", "Joren", "Kael", "Lucian", "Matthias", "Nikolai",
  58. "Orion", "Phoenix", "Quin", "Raphael", "Sebastian", "Tristan", "Uther", "Varian", "Warden", "Xander"
  59. };
  60. private static readonly string[] maleLastNames = {
  61. "Ironforge", "Stormwind", "Blackwater", "Goldleaf", "Silverstone", "Redmane", "Whitehawk", "Greycloak",
  62. "Dragonbane", "Wolfheart", "Bearclaw", "Lionmane", "Eaglefeather", "Ravencrest", "Swiftarrow", "Steelborn",
  63. "Frostbeard", "Fireborn", "Shadowbane", "Lightbringer", "Darkblade", "Brightshield", "Strongarm", "Swiftstrike",
  64. "Stonehammer", "Ironwill", "Goldenshield", "Silverwind", "Blackthorne", "Whitestone", "Redguard", "Greenvale",
  65. "Nightfall", "Dawnbreaker", "Moonwhisper", "Sunblade", "Stargazer", "Stormcaller", "Windrunner", "Earthshaker"
  66. };
  67. // Female character name components
  68. private static readonly string[] femaleFirstNames = {
  69. "Aria", "Brenna", "Celeste", "Diana", "Elara", "Fiona", "Gwendolyn", "Helena", "Iris", "Jasmine",
  70. "Kira", "Luna", "Mira", "Nora", "Ophelia", "Penelope", "Quinn", "Rosalind", "Sera", "Thalia",
  71. "Una", "Vera", "Willow", "Xara", "Yara", "Zara", "Adelina", "Beatrice", "Cordelia", "Delphine",
  72. "Evangeline", "Freya", "Guinevere", "Hazel", "Isolde", "Josephine", "Katarina", "Lyanna", "Morgana", "Natasha",
  73. "Octavia", "Persephone", "Quintessa", "Raven", "Selene", "Titania", "Ursula", "Vivienne", "Winifred", "Xylia"
  74. };
  75. private static readonly string[] femaleLastNames = {
  76. "Moonwhisper", "Starweaver", "Roseheart", "Silverleaf", "Goldenbraid", "Whitedove", "Redrose", "Greenvine",
  77. "Nightsong", "Dawnlight", "Shadowdancer", "Lightweaver", "Brightmoon", "Darkrose", "Swiftwind", "Gentleheart",
  78. "Silverblossom", "Goldenpetal", "Crystalbrook", "Pearlwater", "Sapphiregaze", "Emeraldwing", "Rubyflame", "Amberlight",
  79. "Ivythorn", "Willowbend", "Oakenshield", "Birchwood", "Elmshade", "Ashbloom", "Thornwick", "Briarrose",
  80. "Mistwalker", "Cloudwhisper", "Rainbringer", "Snowfall", "Frostbloom", "Iceheart", "Flamekeeper", "Embersong"
  81. };
  82. public static string GenerateTownName()
  83. {
  84. string prefix = townPrefixes[Random.Range(0, townPrefixes.Length)];
  85. string suffix = townSuffixes[Random.Range(0, townSuffixes.Length)];
  86. return prefix + suffix;
  87. }
  88. public static string GenerateVillageName()
  89. {
  90. string prefix = villagePrefixes[Random.Range(0, villagePrefixes.Length)];
  91. string suffix = villageSuffixes[Random.Range(0, villageSuffixes.Length)];
  92. return prefix + suffix;
  93. }
  94. public static string GenerateForestName()
  95. {
  96. string prefix = forestPrefixes[Random.Range(0, forestPrefixes.Length)];
  97. string suffix = forestSuffixes[Random.Range(0, forestSuffixes.Length)];
  98. return prefix + " " + suffix;
  99. }
  100. public static string GenerateLakeName()
  101. {
  102. string prefix = waterPrefixes[Random.Range(0, waterPrefixes.Length)];
  103. string suffix = lakeSuffixes[Random.Range(0, lakeSuffixes.Length)];
  104. return prefix + " " + suffix;
  105. }
  106. public static string GenerateOceanName()
  107. {
  108. string prefix = waterPrefixes[Random.Range(0, waterPrefixes.Length)];
  109. string suffix = oceanSuffixes[Random.Range(0, oceanSuffixes.Length)];
  110. return prefix + " " + suffix;
  111. }
  112. public static string GenerateMaleCharacterName()
  113. {
  114. string firstName = maleFirstNames[Random.Range(0, maleFirstNames.Length)];
  115. string lastName = maleLastNames[Random.Range(0, maleLastNames.Length)];
  116. return firstName + " " + lastName;
  117. }
  118. public static string GenerateFemaleCharacterName()
  119. {
  120. string firstName = femaleFirstNames[Random.Range(0, femaleFirstNames.Length)];
  121. string lastName = femaleLastNames[Random.Range(0, femaleLastNames.Length)];
  122. return firstName + " " + lastName;
  123. }
  124. public static string GenerateCharacterName(bool isMale = true)
  125. {
  126. return isMale ? GenerateMaleCharacterName() : GenerateFemaleCharacterName();
  127. }
  128. // Generate multiple names for different regions/clusters
  129. public static List<string> GenerateMultipleNames(int count, System.Func<string> generator)
  130. {
  131. List<string> names = new List<string>();
  132. HashSet<string> usedNames = new HashSet<string>();
  133. for (int i = 0; i < count; i++)
  134. {
  135. string name;
  136. int attempts = 0;
  137. do
  138. {
  139. name = generator();
  140. attempts++;
  141. } while (usedNames.Contains(name) && attempts < 50);
  142. if (!usedNames.Contains(name))
  143. {
  144. names.Add(name);
  145. usedNames.Add(name);
  146. }
  147. else
  148. {
  149. // If we can't generate a unique name, add a number
  150. names.Add(name + " " + (i + 1));
  151. }
  152. }
  153. return names;
  154. }
  155. }